找不到页(404)

4 django django-templates django-models django-admin django-views

错误:

Request Method: GET
Request URL:    http://192.168.100.10/accounts/profile/
Using the URLconf defined in urls, Django tried these URL patterns, in this order:
^collect/
^member/
^accounts/login/$
^ ^$
^ ^contact/$
^ ^privacy-statement/$
^logout/$ [name='logout']
^data-admin/doc/
^accounts/password/reset/$
^accounts/password/reset/done/$
^accounts/password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$
^accounts/password/done/$
^media/(?P<path>.*)$
The current URL, accounts/profile/, didn't match any of these.
Run Code Online (Sandbox Code Playgroud)

登录后发生此错误,它接受用户名和密码,它应该成功进入/ index/page但是它会占用帐户/配置文件/.如果我删除帐户/配置文件/并运行ip,它将重定向到正确的网址.

app urls.py

from django.conf.urls.defaults import *

urlpatterns = patterns(
    'zergit.views',
    (r'^$', 'index'),
  )
Run Code Online (Sandbox Code Playgroud)

谢谢

kar*_*ikr 12

您需要更改默认LOGIN_REDIRECT_URL设置

默认情况下,LOGIN_REDIRECT_URL设置为/accounts/profile/.您/accounts/profile/的网址显然没有,因此您需要在登录成功后指定要重定向到的网址.

就像是:

LOGIN_REDIRECT_URL = '/' #Or whatever you wish
Run Code Online (Sandbox Code Playgroud)