Unable to execute Django runserver and no suggested solution seems to work
Question: I've run Django servers on localhost before and have never run into this
problem. I'm desperately trying to figure out what I've done wrong.

I'm using Django 1.4 with Python 2.7 on Ubuntu 12.04.

As far as I can tell I've configured everything correctly - I'm actually using
another functional Django project I built as a go-by.

If I run the following command (or any recommended variation thereof) I
receive an error.

    
    
    django-admin.py runserver localhost:8000
    

Here is the error:

    
    
    ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
    

Can someone please enlighten me as to why this error is occurring, how to fix
it and why it doesn't happen with my other Django project?!?

I've found many posts regarding this problem just by doing some quick Google
searches, but none of the suggested solutions have helped - nor do I truly
understand them.


Answer: I'm pretty sure you're supposed to run

    
    
    manage.py runserver
    

from inside your project directory. It automatically loads your settings.py,
etc.

From the [Django docs](https://docs.djangoproject.com/en/dev/ref/django-
admin/):

> Generally, when working on a single Django project, it’s easier to use
> manage.py. Use django-admin.py with DJANGO_SETTINGS_MODULE, or the
> --settings command line option, if you need to switch between multiple
> Django settings files

