Create Login Page for your Django app
Posted on Tue 09 May 2017 in Django • Tagged with django, python, forms • Leave a comment
Why Another Post about this?
I found each time I start new Django project, I need to create Login HTML page, and with that I need to write Django View and Form. Each time I tried to Google how to do it, I found many posts about how to do it from scratch, yep as you read, posts telling you how to build a Django View and Form for login page. And there are already built-in Django login View and Form (please check links). So I decided to write my own recipe on how to create Login page in your Django app using the built-in view and form to save time and stop reinvent the wheel.
How to do it?
Actually it’s an easy one, because we’ll use already built-in View and Form, so we will build the Template for it, that it. We have a Form and View ready, so first thing first, we’ll write a template to show HTML form for login, I'm assuming you have another template called base.html
and we’ll just write the container block
part only, and we are using Boostrap framework and crispy_form app.
login.html
{% extends "base.html …