Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

On running django, I frequently get the following error:

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

How do I set the evironment variables correctly? I tried the solution here but did not did not have any success.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can set an environment variable with a command like:

export DJANGO_SETTINGS_MODULE=application.settings

Assuming that application.settings is in Python's path, you should then be able to run django-admin using those settings. Alternatively, you can pass a settings module to django-admin on the command line:

django-admin --settings=application.settings ...
share|improve this answer
    
I get the error ImportError: Could not import settings 'application.settings' (Is it on sys.path?): No module named application.settings how can i set this to the python path? –  yayu Apr 14 '12 at 5:00
    
No worries. I figured it out. –  yayu Apr 14 '12 at 5:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.