Opened 18 years ago

Closed 12 years ago

Last modified 11 years ago

#2492 closed defect (worksforme)

Part II of the tutorial fails to load the admin site using SVN Rev. 3528

Reported by: jcruff@… Owned by: Adrian Holovaty
Component: contrib.admin Version: 1.4
Severity: major Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Following the tutorial I'm unable to load the admin site when getting to part II. The traceback is received:

Traceback (most recent call last):
File "/Users/techniq/.python/django/core/handlers/base.py" in get_response

  1. callback, callback_args, callback_kwargs = resolver.resolve(path)

File "/Users/techniq/.python/django/core/urlresolvers.py" in resolve

  1. sub_match = pattern.resolve(new_path)

File "/Users/techniq/.python/django/core/urlresolvers.py" in resolve

  1. for pattern in self.urlconf_module.urlpatterns:

AttributeError at /admin/
'module' object has no attribute 'urlpatterns'

Attachments (1)

views.py (1.5 KB ) - added by anonymous 17 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Adrian Holovaty, 18 years ago

Resolution: worksforme
Status: newclosed

I can't reproduce this, and we haven't heard any similar reports, so I'd suggest going through the tutorial again and making sure you've typed things correctly. If you have more problems, let us know on the django-users mailing list!

comment:2 by mailinglistweb@…, 18 years ago

Resolution: worksforme
Status: closedreopened

I am having the exact same problem with SVN Rev. 3577. Followed the tutorial step by step and came up with the exact same error as described above.

AttributeError at /admin/
   'module' object has no attribute 'urlpatterns'

As a second test, I downloaded the 0.95 release and changed the symlink in site-packages to use 0.95 instead. I restarted the server using the same 'mysite' code user 0.95. In this case, I do not get the same error. I am able to log in under the admin ID.

At this point, though, I have another problem. Operational Error: No such table 'django_admin_log.' This is to be expected, I assume, as a backwards-incompatible change from auth_admin_log.

OperationalError at /admin/
no such table: django_admin_log

Request Method:	GET
Request URL:	http://127.0.0.1:8000/admin/
Exception Type:	OperationalError
Exception Value:	no such table: django_admin_log
Exception Location:	/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/django/db/backends/sqlite3/base.py in execute, line 77

I found a urlpatterns attribute in django.contrib.admin.urls. Perhaps an issue with the resolver?

-- Tom W.

comment:3 by Chris Beaven, 18 years ago

Resolution: worksforme
Status: reopenedclosed

Lack of comments suggests that this isn't a problem with the tutorial.

comment:4 by msj@…, 18 years ago

Happens if you run manage.py syncdb before adding django.contrib.admin to installed_apps. Just run syncdb again to fix.

/Martin

comment:5 by paul at blacksun.org.uk, 17 years ago

The tutorial is probably okay, but there is a problem here - I've just hit exactly the same thing. I tried dropping all the tables, and the whole database, and however many times I re-ran syncdb it still didn't work. Switched to 0.96, ran syncdb (on the same database), and this appeared:

Creating table django_admin_log
Installing index for admin.LogEntry model

So it appears that the Subversion copy wasn't setting up everything it should have done.

I'm running Debian sid (unstable), Python 2.4.4, AMD-64 (though that shouldn't matter). The copy from svn claimed to be 0.97-pre-SVN-6397. Django is installed into my home area, rather than system wide, but again that shouldn't matter.

by anonymous, 17 years ago

Attachment: views.py added

comment:6 by anonymous, 12 years ago

Easy pickings: unset
Resolution: worksforme
Status: closedreopened
UI/UX: unset
Version: master1.4

Working through the tutorial, am on: https://docs.djangoproject.com/en/1.4/intro/tutorial02/

Got:

DatabaseError at /admin/polls/poll/1/
no such table: django_admin_log
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/polls/poll/1/
Django Version: 1.4.2
Exception Type: DatabaseError
Exception Value:
no such table: django_admin_log
Exception Location: /usr/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py in execute, line 344
Python Executable: /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Python Version: 2.7.3
Python Path:
['/Users/user/SteveDjango/mysite',

'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg',
'/usr/local/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg',
'/usr/local/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info',
'/Library/Python/2.7/site-packages',
'/usr/local/lib/python2.7/site-packages',
'/usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']

Server time: Thu, 1 Nov 2012 00:11:58 -0400

in reply to:  6 comment:7 by anonymous, 12 years ago

Resolution: worksforme
Status: reopenedclosed

Replying to anonymous:

Working through the tutorial, am on: https://docs.djangoproject.com/en/1.4/intro/tutorial02/

Got:

DatabaseError at /admin/polls/poll/1/
no such table: django_admin_log
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/polls/poll/1/
Django Version: 1.4.2
Exception Type: DatabaseError
Exception Value:
no such table: django_admin_log
Exception Location: /usr/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py in execute, line 344
Python Executable: /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Python Version: 2.7.3
Python Path:
['/Users/user/SteveDjango/mysite',

'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg',
'/usr/local/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg',
'/usr/local/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info',
'/Library/Python/2.7/site-packages',
'/usr/local/lib/python2.7/site-packages',
'/usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']

Server time: Thu, 1 Nov 2012 00:11:58 -0400

Just run syncdb again to fix.

This worked for me: python manage.py runserver

comment:8 by anonymous, 12 years ago

I had the same error. It was fixed when I added sudo: 'sudo python manage.py runserver'

comment:9 by blukasx@…, 11 years ago

Hey guys,
I know this is old post, but for other searchers:
I had exactly same problem with: no such table: django_admin_log,
and I found answer somewhere else:

"If you get this error when trying to save something in the Django admin,
it's probably because you forgot to synchronize the database after adding
the admin application => $ ./managy.py syncdb"

Source page: http://slaptijack.com/programming/no-such-table-django_admin_log/

Note: See TracTickets for help on using tickets.
Back to Top