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
Make sure you have installed Python 3 and pip
- Download or Clone the project
git clone git@github.com:kazinayem2011/django_authentication.git
- Install virtualenv.
pip install virtualenv
- Create a virtual environment in the project directory.
cd <project_directory>
virtualenv venv
- Start a virtual environment:
source venv/bin/activate
- Install project requirements with pip:
pip install -r requirements.txt
- 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
- 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');
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
To run the test unit of users module, use the following command.
python3 manage.py test users