I've tried Django-registration, see this tutorial to create a full Login-system.
In the tutorials (see STEP 4), I need to update the file urls.py to:
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.contrib import admin
admin.autodiscover()
urlpatterns = patt开发者_运维百科erns('',
(r'^admin/(.*)', admin.site.root),
(r'^accounts/', include('registration.urls')),
(r'^$', direct_to_template,
{ 'template': 'index.html' }, 'index'),
)
But when I do this, the Admin page is not available. When I chance
(r'^admin/(.*)', admin.site.root)
in
(r'^admin/(.*)', admin.site.urls)
The adminpage works; I could login, but I couldn't click on anything... So I couldn't see the registered users.
What am I doing wrong?
You have to use:
(r'^admin/', include(admin.site.urls))
See the documentation.
admin.site.root
was deprecated in Django 1.1, see release notes.
Do you couldn't click on anything because there aren't any links in admin? If so then you have to login as superuser.
Also registration.urls
is deprecated. The new version of django-registration
represents a complete rewrite of the previous codebase and improve flexibility so it is a good idea to use version from repository. It has good quick-start guide.
精彩评论