views:

20

answers:

1

I want to enter to administration application of my site. on request: http://mysite.ru/admin/ - i get an error:

ImportError at /admin/
No module named admin.site.urls
Request Method: GET
Request URL:    http://mysite.ru/admin/
Django Version: 1.2.1
Exception Type: ImportError
Exception Value:    
No module named admin.site.urls
Exception Location: /usr/lib/python2.4/site-packages/django/utils/importlib.py in import_module, line 35
Python Executable:  /usr/bin/python
Python Version: 2.4.3
Python Path:    ['/home/z/sites', '/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg', '/usr/lib/python2.4/site-packages/MySQL_python-1.2.3-py2.4-linux-i686.egg', '/usr/lib/python24.zip', '/usr/lib/python2.4', '/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload', '/usr/lib/python2.4/site-packages', '/usr/lib/python2.4/site-packages/Numeric', '/opt/CollabNet_Subversion/lib/svn-python', '/usr/lib/python2.4/site-packages/gtk-2.0']
Server time:    Fri, 2 Jul 2010 02:19:12 -0500

Admin module i connected as it described here: http://docs.djangoproject.com/en/1.2/intro/tutorial02/

What the problem?

+1  A: 

You probably forgot to uncomment one of the lines in the settings.py:

For example:

Add "django.contrib.admin" to your INSTALLED_APPS setting. Run python manage.py syncdb. Since you have added a new application to INSTALLED_APPS, the database tables need to be updated.

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin', #<----      !!!!! Uncomment
    'mysite.polls'
)

And in your urls.py: (Although it looks like you've done this step already)

# Uncomment the next two lines to enable the admin:
from django.contrib import admin #<----                     !!!!! Uncomment
admin.autodiscover() #<----                                 !!!!! Uncomment

urlpatterns = patterns('',
    # Example:
    # (r'^mysite/', include('mysite.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/', include(admin.site.urls)), #<----          !!!!! Uncomment
)
John Weldon
@John Weldon, i forgot remove the quotes from the line: `(r'^admin/', include(admin.site.urls))`, your answer helps me to see this error. thank you.
Kalinin