Django Custom Auth User Model from AbstractBaseUser

Technologies Used
Python Django HTML CSS Bootstrap Javascript Postgres Heroku Github

Geek Glases | Django Complete Auth Using Custom Auth Model

Description


This project is implementation for the following topics related to technologies used with Django


-Implemented Complete Auth Using Custom Auth Model.

  1. Used built in AbstractBaseUser as parent Auth Model
  2. Build Custom Manager for the same
  3. Implemented custom error View for customizing Templates
  4. Login. SingUp, Logout, Account Views Implemented
  5. In built views of PasswordChangeDoneView, PasswordChangeView, PasswordResetCompleteView, PasswordResetConfirmView, PasswordResetView, PasswordResetCompleteView
  6. Build Custom Templates for These Inbuilt Views
  7. Reset Password is working
  8. If kyc is False then it will show you Get Kyc Details unless it will welcome you. By default, every user is non kyc-ied.
  9. If you want to kyc a person login to admin panel from here: https://django-custom-auth-model.herokuapp.com/admin/ and modify it

-Deployed on Hostinger VPS

  1. Used Heroku Postgres

Demo


Available at: https://github.com/arpansahu/geek_glasses

admin login details:-- email: admin@arpansahu.me password: showmecode


License


MIT


Installation


Installing Pre requisites

pip install -r requirements.txt
   

Making Migrations and Migrating them.

python manage.py makemigrations
   python manage.py migrate
   

Creating Super User.

python manage.py createsuperuser
   

Run Server.

python manage.py runserver
   

Deployment on Heroku


Installing Heroku Cli

checkout: https://devcenter.heroku.com/articles/heroku-cli
   

Create your account in Heroku.

Inside your project directory

Login Heroku CLI

heroku login
   

Create Heroku App

heroku create [app_name]
   

Push Heroku App

git push heroku master
   

Configure Heroku App Env Variables

heroku config:set GITHUB_USERNAME=joesmith
   

Configuring Django App for Heroku


Install whitenoise

pip install whitenoise
   

Include it in Middlewares.

MIDDLEWARE = [
       # ...
       "django.middleware.security.SecurityMiddleware",
       "whitenoise.middleware.WhiteNoiseMiddleware",
       # ...
   ]
   

Create Procfile and include this code snippet in it.

release: ./release-tasks.sh
   web: gunicorn djangoProject.wsgi
   

Create release-task.sh for running multilple commands in run: section of procfile.

python manage.py makemigrations
   python manage.py migrate
   

Make release-task.sh executable

chmod +x release-tasks.sh
   

Environment Variables


To run this project, you will need to add the following environment variables to your .env file

SECRET_KEY=
   DEBUG=
   DB_HOST=
   DB_NAME=
   DB_USER=
   DB_PASSWORD=
   DB_PORT=
   EMAIL_USER=
   EMAIL_PASS=
   ALLOWED_HOSTS=