Boilerplate: Add Basic User Authencation To A Django Site
Introduction
This process sets up for basic user authentication. It's designed to be run after going through Boilerplate: Create A New Django Site/Project and Boilerplate: Add Basic Template And Static File Handling In Django .
Boilerplate Steps
-
Make sure you've started the Python venv and are in the directory with: manage.py
TODO: Write up how to make sure you're in the proper venv
-
Make the directory to hold the necessary templates:
terminal commands -
Add login/logout default redirects to the bottom of the
site_files/settings.py filesite_files/settings.py - append to end of file -
Add the includes import and auth include to
site_files/urls.py . The file should look like this:site_files/urls.py - full content replacement -
Make the
registration/login.html page template:templates/registration/login.html - new file -
Make the
registration/login_status.html page templatetemplates/registration/login_status.html - new file
Next Steps
That's it for the basic login/logout functionality. You're ready to work on the site or go back to the home page and pick a Boilerplate Task to try out.
Boilerplate Details
-
Right now this boilerplate only sets up so that login/logout can be used with the built-in users in a dev environment
-
TBD on what needs to change before deploying to production
-
The super user account created in Boilerplate: Create A New Django Site/Project can be used for the test account but a better thing to do from a security perspective would be to create another account. I'll add that to a boilerplate in a future update.