Criteria
This project demo a backend RESTful API use Django framework
Source
https://github.com/duycs/demo-django
Keywords
- Python
- Django
- RESTAPI
- Authentication with JWT
- MySQL
Installation
- Install Python 3.6.x
- Install Django 2.x
python -m pip install Django
- Install Mysql
- Create/update DATABASES variables at apps/settings.py file to correct your local Mysql
Stpes
- Clone this repository
- Open terminal
- Go to root folder
demo-django
- Install some libs
pip install -r requirements.txt
- Migrate
python manage.py makemigrations
python manage.py migrate
5.1 Some exception case when migration
- https://simpleisbetterthancomplex.com/tutorial/2016/07/26/how-to-reset-migrations.html
- Run at local
python manage.py runserver
Create new app
- Create folder where create app
mkdir ./demo/apps/app-names
- Generate app-names
django-admin.py startapp app-name ./demo/apps/app-names
- Add config app to settings
INSTALLED_APPS = [ .... 'demo.apps.app-names', ]
TODO
- Refresh-token
- Logout will add token to black list
- Modeling with domain
- Aggregate relations
- Serializers
- Enpoints API for bussiness
- Containerization
- Authorization
Bugs
- Swagger doc don’t show if require authentication
- Swagger exception at Django 3
- Expired token time
References
- https://docs.djangoproject.com/en/3.0/
- https://www.django-rest-framework.org/tutorial/
- https://thinkster.io/tutorials/django-json-api/
- https://github.com/gothinkster/conduit-django
- https://django-rest-swagger.readthedocs.io/en/latest/
- https://github.com/axios/axios
- https://simpleisbetterthancomplex.com/tutorial/2016/07/26/how-to-reset-migrations.html