#2492 closed defect (worksforme)
Part II of the tutorial fails to load the admin site using SVN Rev. 3528
Reported by: | 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
- callback, callback_args, callback_kwargs = resolver.resolve(path)
File "/Users/techniq/.python/django/core/urlresolvers.py" in resolve
- sub_match = pattern.resolve(new_path)
File "/Users/techniq/.python/django/core/urlresolvers.py" in resolve
- for pattern in self.urlconf_module.urlpatterns:
AttributeError at /admin/
'module' object has no attribute 'urlpatterns'
Attachments (1)
Change History (10)
comment:1 by , 18 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:2 by , 18 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
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 , 18 years ago
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
Lack of comments suggests that this isn't a problem with the tutorial.
comment:4 by , 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 , 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 , 17 years ago
follow-up: 7 comment:6 by , 12 years ago
Easy pickings: | unset |
---|---|
Resolution: | worksforme |
Status: | closed → reopened |
UI/UX: | unset |
Version: | master → 1.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
comment:7 by , 12 years ago
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
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 , 12 years ago
I had the same error. It was fixed when I added sudo: 'sudo python manage.py runserver'
comment:9 by , 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/
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!