an error about DJANGO_SETTINGS_MODULE

aimeixu aimeixu at amazon.com
Thu Jul 22 04:14:14 EDT 2010


Hi,
I use python Django framework to make a bookmark website, when I 
clicked  login button on  the user login page .and I  import "from 
django.contrib.auth.models import User" in the console,It will occur the 
following error:
 >>> from django.contrib.auth.models import User
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/django/contrib/auth/models.py", 
line 6, in ?
    from django.db import models
  File "/usr/lib/python2.4/site-packages/django/db/__init__.py", line 
14, in ?
    if not settings.DATABASES:
  File "/usr/lib/python2.4/site-packages/django/utils/functional.py", 
line 276, in __getattr__
    self._setup()
  File "/usr/lib/python2.4/site-packages/django/conf/__init__.py", line 
38, in _setup
    raise ImportError("Settings cannot be imported, because environment 
variable %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable 
DJANGO_SETTINGS_MODULE is undefined.
'cause I am a newbie to python .Please help me find out where the error 
is and how to solve this problem. Thanks a lot.
Best Wishes,



More information about the Python-list mailing list