Pass the guide from the book on the framework Django. The book is 2017, but there are already some differences in versions, which during the implementation of the project make themselves felt, but this is generally solved. The manual has come to authorization of users. Actually, the following code is proposed:
Urls.py:
from django.conf.urls import url from django.contrib.auth.views import login from . import views app_name = "users" urlpatterns = [ url(r'^login/$', login, {'template_name': 'users/login.html'}, name='login'), ] Fix django.contrib.auth.views, removing "views". The server starts and I get a response:
TypeError at / users / login /
login () got an unexpected keyword argument 'template_name'
I look through the ways to solve the problem on the Internet, I come across the opportunity to change the import and the path to the following:
from django.contrib.auth.views import LoginView urlpatterns = [ url(r'^login/$', LoginView, {'template_name': 'users/login.html'}, name='login'), ] Already for this, I get the following error:
TypeError at / users / login /
init () takes 1 positional argument but 2 were given
And here I have a stupor and I can not figure it out. Tell me, please, from what should I make a start in resolving the situation?