我正在使用Django 1.11和新手。
我正在使用默认登录和注销功能。
当我登录时,它会重定向到accounts/profile
,然后生成错误
Using the URLconf defined in myapp.urls, Django tried these URL patterns, in this order:
^ ^login/$ [name='login']
^ ^logout/$ [name='logout']
^ ^password_change/$ [name='password_change']
^ ^password_change/done/$ [name='password_change_done']
^ ^password_reset/$ [name='password_reset']
^ ^password_reset/done/$ [name='password_reset_done']
^ ^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$ [name='password_reset_confirm']
^ ^reset/done/$ [name='password_reset_complete']
^ ^$ [name='home']
^pages/
^search/
^admin/
The current path, accounts/profile/, didn't match any of these.
Django中有accounts
内置函数吗?
如果是,如何访问accounts
应用的网址?如果不是,为什么会这样?
编辑2:来自
的网址格式myapp.urls.py
urlpatterns = [
url('^', include('django.contrib.auth.urls')),
url('^', include('pages.urls')),
url(r'^pages/', include('pages.urls')),
url(r'^search/', include('search.urls')),
url(r'^admin/', admin.site.urls),
]
答案 0 :(得分:1)
默认情况下,Django中的成功登录重定向到:
?next=
参数传递的网址,或settings.LOGIN_REDIRECT_URL
的网址。答案 1 :(得分:0)
网址帐户,通常附带包django-registration
。就我而言,它实现为url(r'^accounts/', include('registration.backends.simple.urls')),
。从那里重定向工作。即帐户/登录,帐户/注册等。请参阅documentation