I
I
Igor Andreev2019-02-26 15:31:43
Django
Igor Andreev, 2019-02-26 15:31:43

Django Unleashed. Why won't the page open so I can log in?

Good day everyone!
Tell me who can I'm working
on the book "Django Unleashed" https://django-unleashed.com
But I ran into a problem on the item "19.5.4 Post-Authentication Redirection", the page to log in does not open, an error is generated:
TemplateDoesNotExist
django.template. exceptions.TemplateDoesNotExist: registration/login.html
I can't figure out what this template is and why it's needed. It is not used in the tutorial and everything should work without it
Link to github for current files is attached: https
://github.com/igor-va/Django_Unleashed/tree/m...
total error:
suorganizer/urls.py - main url

from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import (
    RedirectView, TemplateView)

from blog import urls as blog_urls
from contact import urls as contact_urls
from organizer.urls import (
    startup as startup_urls, tag as tag_urls)
from user import urls as user_urls

urlpatterns = [
    url(r'^$',
        RedirectView.as_view(
            pattern_name='blog_post_list',
            permanent=False)),
    url(r'^about/$',
        TemplateView.as_view(
            template_name='site/about.html'),
        name='about_site'),
    url(r'^admin/', admin.site.urls),
    url(r'^blog/', include(blog_urls)),
    url(r'^contact/', include(contact_urls)),
    url(r'^startup/', include(startup_urls)),
    url(r'^tag/', include(tag_urls)),
    url(r'^user/',
        include(
            user_urls,
            namespace='dj-auth')),
]

user/urls.py - plugin app
from django.conf.urls import url
from django.contrib.auth import \
    views as auth_views
from django.contrib.auth.forms import \
    AuthenticationForm
from django.views.generic import RedirectView

app_name = 'user'
urlpatterns = [
    url(r'^$',
        RedirectView.as_view(
            pattern_name='dj-auth:login',
            permanent=False)),
    url(r'^login/$',
        auth_views.LoginView.as_view(),
        {'template_name': 'user/login.html'},
        name='login'),
    url(r'^logout/$',
        auth_views.LogoutView.as_view(),
        {'template_name': 'user/logged_out.html',
         'extra_context':
             {'form': AuthenticationForm}},
        name='logout'),
]

Thank you all in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2019-03-03
@skipirich

try moving templates from /user/templates/user to /templates/user. i.e. to the /templates folder which is at the root of the project

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question