Django 1.10. Why does settings.LOGIN_URL by default belong to / accounts / login /, and django.contrib.auth.urls uses ^ login / $?

I migrate to Django 1.10 and try to fix login errors.

So, let's move on to themes.auth.default Using Views

I do the following:

urlpatterns = [
    ....
    url('^', include('django.contrib.auth.urls')),
]

OK, and now I get 404 / accounts / login not existing. Now, since this is an existing application, I move on to Django 1.10, I first realized that I forgot this URL somewhere.

But I could not find him. Then it turns out that in Django:

django.conf.global_settings

LOGIN_URL = '/accounts/login/'

But Using submission , says:

This will include the following URL patterns:
    ^ login / $ [name = 'login']

django.contrib.auth.urls

urlpatterns = [
    url(r'^login/$', views.login, name='login'),

, settings.LOGIN_URL.

, URL-, @ /login/. /accounts/login/.

LOGIN_URL = LOGIN_REDIRECT_URL = '/login/'. , , , , 404.

urls.py :

 url('^accounts/', include('django.contrib.auth.urls')),

? , /accounts/xxx auth .

+4

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


All Articles