Skip to content

kazinayem2011/django_authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Django simple authentication

A simple example of role based authentication system. What can you find here:

  • Custom User registration and login system with role based functionality
  • Signup and Signin option with gmail
  • Request tracking option
  • Download PDF report
  • API documentation with public endpoint
  • Test code

Prerequisites

Make sure you have installed Python 3 and pip

Installation

  1. Download or Clone the project
git clone git@github.com:kazinayem2011/django_authentication.git
  1. Install virtualenv.
pip install virtualenv
  1. Create a virtual environment in the project directory.
cd <project_directory>
virtualenv venv
  1. Start a virtual environment:
source venv/bin/activate
  1. Install project requirements with pip:
pip install -r requirements.txt
  1. Create a mysql database by naming 'misfit', make sure about password field on database connection in settings.py file and run the command
python3 manage.py makemigrations
python3 manage.py migrate
  1. Run the below mysql command in your database for creating 3 types of role. (Role has been used statically as their is no requirement for dynamic solution)
INSERT INTO `users_role` (`id`, `role_title`) VALUES
(4, 'Employee'),
(3, 'HR'),
(1, 'Manager');

Run

Now run the development server by typing the next command, to stop the server just press Ctrl + C:

python3 manage.py runserver

Browse url with:

http://localhost:8000

Unit Testing

To run the test unit of users module, use the following command.

python3 manage.py test users