I'm not using virtualenv. django.contrib.admin wants a
DJANGO_SETTINGS_MODULE to be set:

Inner Sanctum ~/directory $ python
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django.contrib.admin
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/__init__.py",
line 1, in <module>
    from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
  File
"/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/helpers.py",
line 1, in <module>
    from django import forms
  File
"/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/forms/__init__.py",
line 17, in <module>
    from models import *
  File
"/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/forms/models.py",
line 6, in <module>
    from django.db import connections
  File
"/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/db/__init__.py",
line 14, in <module>
    if not settings.DATABASES:
  File
"/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/utils/functional.py",
line 276, in __getattr__
    self._setup()
  File
"/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/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.
>>>

On Wed, Aug 18, 2010 at 1:00 AM, Sam Lai <[email protected]> wrote:

> This error looks like an import error in disguise. (
> http://code.djangoproject.com/browser/django/tags/releases/1.2.1/django/utils/importlib.py
> )
>
> Fire up the python interpreter shell, and trying importing the
> django.contrib.admin module manually and see if you get any errors.
>
> Django seems to be installed ok according to your python path. Are you
> using virtualenv at all?
>
>
> On 18 August 2010 12:23, Christos Jonathan Hayward <
> [email protected]> wrote:
>
>> I realized there may have been some pre-existing stuff in the directory,
>> so I renamed it and extracted fresh from tarball. I got an error I had seen
>> earlier but couldn't reproduce:
>>
>> AttributeError at /
>>
>> 'module' object has no attribute 'register'
>>
>>  Request Method:GET Request URL:http://localhost:8000/ Django Version:
>> 1.2.1 Exception Type:AttributeError Exception Value:
>>
>> 'module' object has no attribute 'register'
>>
>>  Exception 
>> Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/utils/importlib.py
>> in import_module, line 35 Python Executable:/usr/bin/python Python
>> Version:2.6.1 Python Path:['/Users/jonathan/directory',
>> '/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg',
>> '/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload',
>> '/Library/Python/2.6/site-packages',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC',
>> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']
>>  Server
>> time:Tue, 17 Aug 2010 21:20:53 -0500
>>
>> On Tue, Aug 17, 2010 at 8:39 PM, Christos Jonathan Hayward <
>> [email protected]> wrote:
>>
>>> Thank you; I'm not seeing how. My admin.py reads:
>>>
>>> import django.contrib.admin
>>> import directory.models
>>> import tagging
>>>
>>> django.contrib.admin.autodiscover()
>>> django.contrib.admin.site.register(directory.models.Entity)
>>> django.contrib.admin.site.register(directory.models.Location)
>>> tagging.register(directory.models.Entity)
>>>
>>>
>>> Commenting the tagging.register() call doesn't seem to make a difference.
>>>
>>> On Tue, Aug 17, 2010 at 8:27 PM, Sam Lai <[email protected]> wrote:
>>>
>>>> It means somehow you're calling this line in an admin.py file twice -
>>>>
>>>> admin.site.register(Entity)
>>>>
>>>> Check the admin.py file for the app that contains the Entity model.
>>>>
>>>> On 18 August 2010 10:57, Christos Jonathan Hayward <
>>>> [email protected]> wrote:
>>>>
>>>>> I am trying to migrate from one server to another: I tarred it up on
>>>>> the Linux server, untarred on a Mac, got one or two complaints about 
>>>>> missing
>>>>> packages, and when I had resolved them, got the error below.
>>>>>
>>>>> Entity is the name of one of my models. What does this mean, and how is
>>>>> this issue addressed? (I had been actively developing on the old server 
>>>>> and
>>>>> don't remember seeing this error.)
>>>>>
>>>>> AlreadyRegistered at /
>>>>>
>>>>> The model Entity is already registered
>>>>>
>>>>>  Request Method:GET Request URL:http://localhost:8000/ Django Version:
>>>>> 1.2.1 Exception Type:AlreadyRegistered Exception Value:
>>>>>
>>>>> The model Entity is already registered
>>>>>
>>>>> Exception 
>>>>> Location:/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg/django/contrib/admin/sites.py
>>>>> in register, line 78 Python Executable:/usr/bin/python Python Version:
>>>>> 2.6.1 Python Path:['/Users/jonathan/directory',
>>>>> '/Library/Python/2.6/site-packages/Django-1.2.1-py2.6.egg',
>>>>> '/Library/Python/2.6/site-packages/tagging-0.2.1-py2.6.egg',
>>>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
>>>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
>>>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
>>>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
>>>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
>>>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python',
>>>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
>>>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
>>>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload',
>>>>> '/Library/Python/2.6/site-packages',
>>>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC',
>>>>> '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode']
>>>>>  Server
>>>>> time:Tue, 17 Aug 2010 19:53:40 -0500
>>>>> --
>>>>> [image: Christos Jonathan Hayward ← An Orthodox Christian 
>>>>> author.]<http://JonathansCorner.com>
>>>>> Christos Jonathan Hayward, an Orthodox Christian author.
>>>>>
>>>>> Author Bio <http://JonathansCorner.com/author/> • 
>>>>> Books<http://CJSHayward.com/>
>>>>>  • *Email <[email protected]>* • 
>>>>> Facebook<http://www.facebook.com/christos.jonathan.hayward>
>>>>>  • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • 
>>>>> Twitter<http://twitter.com/JonathansCorner>
>>>>>  • *Web <http://JonathansCorner.com/>* • What's 
>>>>> New?<http://JonathansCorner.com/>
>>>>> I invite you to visit my "theology, literature, and other creative
>>>>> works" site.
>>>>>
>>>>>  --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To post to this group, send email to [email protected].
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected]<django-users%[email protected]>
>>>>> .
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/django-users?hl=en.
>>>>>
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected]<django-users%[email protected]>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/django-users?hl=en.
>>>>
>>>
>>>
>>>
>>> --
>>> [image: Christos Jonathan Hayward ← An Orthodox Christian 
>>> author.]<http://JonathansCorner.com>
>>> Christos Jonathan Hayward, an Orthodox Christian author.
>>>
>>> Author Bio <http://JonathansCorner.com/author/> • 
>>> Books<http://CJSHayward.com/>
>>>  • *Email <[email protected]>* • 
>>> Facebook<http://www.facebook.com/christos.jonathan.hayward>
>>>  • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • 
>>> Twitter<http://twitter.com/JonathansCorner>
>>>  • *Web <http://JonathansCorner.com/>* • What's 
>>> New?<http://JonathansCorner.com/>
>>> I invite you to visit my "theology, literature, and other creative works"
>>> site.
>>>
>>>
>>
>>
>> --
>> [image: Christos Jonathan Hayward ← An Orthodox Christian 
>> author.]<http://JonathansCorner.com>
>> Christos Jonathan Hayward, an Orthodox Christian author.
>>
>> Author Bio <http://JonathansCorner.com/author/> • 
>> Books<http://CJSHayward.com/>
>>  • *Email <[email protected]>* • 
>> Facebook<http://www.facebook.com/christos.jonathan.hayward>
>>  • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • 
>> Twitter<http://twitter.com/JonathansCorner>
>>  • *Web <http://JonathansCorner.com/>* • What's 
>> New?<http://JonathansCorner.com/>
>> I invite you to visit my "theology, literature, and other creative works"
>> site.
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<django-users%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<django-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
[image: Christos Jonathan Hayward ← An Orthodox Christian
author.]<http://JonathansCorner.com>
Christos Jonathan Hayward, an Orthodox Christian author.

Author Bio <http://JonathansCorner.com/author/> • Books<http://CJSHayward.com/>
 • *Email <[email protected]>* •
Facebook<http://www.facebook.com/christos.jonathan.hayward>
 • LinkedIn <http://www.linkedin.com/in/jonathanhayward> •
Twitter<http://twitter.com/JonathansCorner>
 • *Web <http://JonathansCorner.com/>* • What's
New?<http://JonathansCorner.com/>
I invite you to visit my "theology, literature, and other creative works"
site.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to