Page Not Found (404)

Error:

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. 

This error occurs after logging in, it accepts a username and password, and it should successfully go to / index / page, but it accepts accounts / profile /. If I delete the accounts / profile / and run ip, it redirects the correct urls.

app urls.py

 from django.conf.urls.defaults import * urlpatterns = patterns( 'zergit.views', (r'^$', 'index'), ) 

thanks

+4
source share
2 answers

You need to change the settings LOGIN_REDIRECT_URL

By default, LOGIN_REDIRECT_URL set to /accounts/profile/ . You obviously do not have /accounts/profile/ in your URLs, so you need to specify which URL you want to redirect as soon as the login is successful.

Sort of:

 LOGIN_REDIRECT_URL = '/' #Or whatever you wish 
+12
source

If you do not want to change the LOGIN_REDIRECT_URL parameter, simply use the "next" parameter and the value in the login URL of your account to redirect to wherever you want. For example, the OP could indicate the requested login URL as " http://192.168.100.10/accounts/login/?next=/index/ "

0
source

Source: https://habr.com/ru/post/1489117/


All Articles