Every time I log on to my server through SSH I need to type the following:
export DJANGO_SETTINGS_MODULE=settings
if I do not any usage of the
Yourmanage.py
is referencing an application (notifications
). This forces Django to complain about DJANGO_SETTINGS_MODULE being set because the Django environment hasn't been set up yet.
Incidentally, you can force the enviroment setup manually, but honestly I wouldn't do this in manage.py. That's not really a good practice in my opinion.
Here is how you can manually setup the Django environment from within any app (or program for that matter):
# set up the environment using the settings module
from django.core.management import setup_environ
from myapp import settings
setup_environ(settings)