an error about DJANGO_SETTINGS_MODULE

Chris Rebert clp2 at rebertia.com
Thu Jul 22 05:21:29 EDT 2010


On Thu, Jul 22, 2010 at 1:14 AM, aimeixu <aimeixu at amazon.com> wrote:
> 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.

The Django-specific mailinglist may be found at:
http://groups.google.com/group/django-users

You are more likely to get a [better] answer if you ask there.

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list