Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 2 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

Your Answer


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.