Django Rest Framework project
This is a Django Rest Framework project. It is a template for building REST APIs with Django Rest Framework. It is built with the following features;
- User Authentication with JWT
- User Registration
- User Login
- User Logout
- User Password Reset
- User Password Change
- User Profile Update
- Users List API
- Users Detail API
- API Keys Integration: Using Secret keys and Public keys
- Admin and API key DRF Permissions
- Github Actions for CI/CD testing
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
For installing the project, you will need to have;
-
Python installed. Python version supported is
3.9
. The Github actions use 3.9 for running live tests. -
If Must have PostgreSQL installed. You can use WSL2 to do this on Windows 10 and 11.
Use postgresql only if you are using it as your default database. If you are using sqlite, you can skip this step.
A step by step series of examples that tell you how to get a development environment running.
Clone the project
Setup virtual enviroment & install dependencies
Linux
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cd src
mkdir logs
Windows
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
cd src
mkdir logs
Copy the env.example file to .env
cp env.example .env
Run migrations
python manage.py migrate
Run the server
python manage.py runserver
Run tests to make sure all is working before you start contributing
pytest --no-cov
This must be used to ensure all coding style guidelines are met
flake8
To run the API on your local system.
python manage.py runserver
API server will run on http://localhost:8000/
. Visit Swagger to read the Swagger API documentation.
The following method describes how to deploy this on a live system.
- Install Ngrok on your machine.
- Run API server
- Open CMD / CLI, Run
ngrok http 8000
.8000
is used if that's the port the API server is listening to. Otherwise, use the listening port. - The rest is history!
Use the following steps below to contribute to this project.
- First checkout to the
dev
branch - Create a new branch for your feature
- Make your changes
- Commit your changes
- Push your changes to your branch
- Create a pull request to the
dev
branch - Wait for review and merge
- Django - Web Framework
- Django Rest Framework - Building Web APIs
- PostgreSQL - Database
- Redis - In-memory data store
- Python - Programming Language
- @devvspaces - Project Setup & Initial work
- Hat tip to anyone whose code was used
- Inspiration
- References