找不到页面(404) [英] Page not found (404)

查看:841
本文介绍了找不到页面(404)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:

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.

登录后发生此错误,它接受用户名和密码,并且应该成功获取到/索引/页,但它是采取帐户/配置文件/。如果我删除帐户/配置文件/并运行ip,它正在重定向到正确的URL。

This error occurs after login,it is accepting user name and password and it should successfully take to /index/ page but it is taking to accounts/profile/.If i remove the accounts/profile/ and run the ip,it is redirecting to the correct urls.

应用程序URL .py

app urls.py

from django.conf.urls.defaults import *

urlpatterns = patterns(
    'zergit.views',
    (r'^$', 'index'),
  )

谢谢

推荐答案

您需要更改默认的 LOGIN_REDIRECT_URL 设置

You need to change the default LOGIN_REDIRECT_URL settings

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

By default, LOGIN_REDIRECT_URL is set to /accounts/profile/. You clearly dont have a /accounts/profile/ in your URLs, so you need to specify which URL you want to be redirected to once the login is successful.

如下所示:

LOGIN_REDIRECT_URL = '/' #Or whatever you wish

这篇关于找不到页面(404)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆