Opened 15 years ago

Closed 15 years ago

#11792 closed (invalid)

incorrect activation of the code for admin site in urls.py

Reported by: anonymous Owned by: nobody
Component: Documentation Version: 1.1
Severity: 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

I downloaded Django-1.1 and while going trough the tutorial, the code under the section "Activate the admin site" didn't work.
I found that the correct code was


from django.conf.urls.defaults import *
from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns(,

# Example:
# (r'mysite/', include('mysite.foo.urls')),

# Uncomment this for admin:

(r'admin/(.*)', admin.site.root),

)


which is different from the one exposed in the page as:


from django.conf.urls.defaults import *

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

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)),

)


Change History (1)

comment:1 by Karen Tracey, 15 years ago

Resolution: invalid
Status: newclosed

If you could not get the

# Uncomment the next line to enable the admin: 
(r'admin/', include(admin.site.urls)), 

version to work then I suspect you were not using 1.1. It is definitely the correct code for 1.1, as it was added for 1.1. (The earlier admin.site.root code will still work with 1.1 though it is on its way to being deprecated.)

You say you downloaded 1.1 -- are you sure you do not also have some earlier version installed that is getting picked up instead of the one you just retrieved (and, I assume, installed somewhere)?

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