How can I use django.auth.views.login? I am trying to make a user login but I can’t figure out how to use it. Is there a thing you add to urls.py. I have an intermediate understanding of django. Thanks in advance!
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For a quick and simple login view you just have to add the following to your urlpatterns in your urls.py file (You can change the regex to match whatever location you need it to match):
Next, add a directory called “registration” in your main templates folder, and within that create an html file called “login.html”. This is the file that will be rendered with the login form. You can customize it to your hearts content, but here’s a basic version:
And that should do it. Obviously, there’s a lot more you can do there but that should get you started. For more details you can go here: http://docs.djangoproject.com/en/dev/topics/auth/#authentication-in-web-requests