devvspaces / django-restframework-template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project logo

Project REST API

Status GitHub Issues GitHub Pull Requests License


Django Rest Framework project

πŸ“ Table of Contents

🧐 About

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

🏁 Getting Started

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.

Prerequisites

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.

Installing

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

πŸ”§ Running the tests

Run tests to make sure all is working before you start contributing

pytest --no-cov

And coding style tests

This must be used to ensure all coding style guidelines are met

flake8

🎈 Usage

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.

πŸš€ Deployment

The following method describes how to deploy this on a live system.

Using Ngrok

  • 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!

Using Nginx on an Ubuntu Server

Coming soon


Contributing

Use the following steps below to contribute to this project.

  1. First checkout to the dev branch
  2. Create a new branch for your feature
  3. Make your changes
  4. Commit your changes
  5. Push your changes to your branch
  6. Create a pull request to the dev branch
  7. Wait for review and merge

⛏️ Built Using

✍️ Authors

πŸŽ‰ Acknowledgements

  • Hat tip to anyone whose code was used
  • Inspiration
  • References

About


Languages

Language:Python 100.0%