Skip to content

AliBigdeli/Django-CustomUser-DRF-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django CustomUser DRF App

A base project for custom authentication with api and tests

python django sqlite html5 sqlite

Overview

Features

  • Django LTS
  • Custom User Model
  • Profile model
  • Signal attachments
  • Django RestFramework
  • Token Authentication
  • JWT Authentication
  • APi Docs
  • Black
  • Flake8
  • Tests

Setup

To get this repository, run the following command inside your git enabled terminal

git clone https://github.com/alibigdeli/Django-CustomUser-DRF-App

Getting ready

Create an enviroment in order to keep the repo dependencies seperated from your local machine.

python -m venv venv

Make sure to install the dependencies of the project through the requirements.txt file.

pip install -r requirements.txt

Once you have installed django and other packages, go to the cloned repo directory and run the following command

python manage.py makemigrations

This will create all the migrations file (database migrations) required to run this App.

Now, to apply this migrations run the following command

python manage.py migrate

options

you can use the createsuperuser option to make a super user.

python manage.py createsuperuser

And lastly let's make the App run. We just need to start the server now and then we can start using our Authentication App. Start the server by following command

python manage.py runserver

Once the server is up and running, head over to http://127.0.0.1:8000 for the App but it will be empty!

Api and Documents

in order to use the api in document format you can simply head to this url

http://127.0.0.1:8000/swagger/

database schema

or if you prefer redoc you can use :

http://127.0.0.1:8000/redoc/

database schema

and for importing the api into your postman the link for that will be this:

http://127.0.0.1:8000/swagger/api.json

Reformat and check

If you want your code to be check by pep8 and all the guide lines, there are two packages added to requirements in order to check and reformat code. you can use it by this command:

black -l 79 . && flake8

Database schema

A simple view of the project model schema.

database schema

Todo

  • complete the documentation
  • add api tests
  • create a video tutorial

Bugs or Opinion

Feel free to let me know if there are any problems or any request you have for this repo.