Custom Search

Wednesday, March 31, 2010

environment variable DJANGO_SETTINGS_MODULE is undefined

solution to environment variable DJANGO_SETTINGS_MODULE is undefined

If you're playng with Django directly from Python, and not from Django's own manage.py shell, then you need to set the DJANGO_SETTINGS_MODULE variable before launching Python.

For example, if you have a Django project named "myproject", then run the following before launching Python:

export DJANGO_SETTINGS_MODULE=myproject.settings

For Apache to pick up that variable, you need to set it in httpd.conf as follows:

SetEnv DJANGO_SETTINGS_MODULE myproject.settings

Example:
saju@saju-pardus ~ $ export DJANGO_SETTINGS_MODULE=myproject.settings
saju@saju-pardus ~ $ echo $DJANGO_SETTINGS_MODULE
myproject.settings

No comments:

Post a Comment