Skip to content

Fingerstyle-Taiwan/django-backend

Repository files navigation

Fingerstyle Taiwan Backend Project

Github License Code Coverage Django 4 Python 3.10

Fingerstyle Taiwan page backend project, using django and postresql for development.

Table of content

Getting Started

Clone project

git clone https://github.com/Fingerstyle-Taiwan/django-backend.git
cd django-backend

Build docker container and apps

make dev/build

Start docker apps (Django and PostgreSQL)

This command will launch django server and database. See http://127.0.0.1:8000/admin

make dev/up

If you get a database error after make up, just try the code below, it will remove the database from disk, then rebuild volume again.

make dev/down
make dev/database-init
make dev/up

Setup a superuser for development

make dev/superuser

See APIs docs

See http://127.0.0.1:8000/docs APIs docs screenshot

Stop docker apps (Django and PostgreSQL)

make dev/down

Usage

make commands help

make help
Available targets:

  certbot/init                        SSL certification initialization
  dev/build                           Build docker image for development
  dev/check                           Run test and lint
  dev/create-app                      Create a Dajango Application used by "make dev/create-app NAME=YouAppNameHere"
  dev/database-init                   Initialization for docker volumes
  dev/down                            Stop development containers
  dev/lint                            Run code style tool
  dev/migrate                         Migrate for database
  dev/migrate-init                    Initialize migrations for database
  dev/migrations                      Make migrations for database
  dev/superuser                       Create a superuser
  dev/test                            Run unit test 
  dev/up                              Run development containers
  monitor/down                        Stop monitor service containers
  monitor/up                          Start monitor service containers
  prod/down                           Stop production containers 
  prod/logs                           Peek logs 
  prod/rebuild                        Rebuild Django app image
  prod/restart                        Rebuild Django app
  prod/superuser                      Create a superuser
  prod/up                             Run production containers

Lint and test (IMPORTANT:do this before you git push, github actions will auto lint and test)

  • lint
make dev/lint
  • test
make dev/test

Django commands

  • create a django app
 make dev/create-app NAME=YouAppName
  • create superuser
make dev/superuser
  • migrations
make dev/migrations
  • migrate
make dev/migrate

Git commit

Please use commitizen-tools to submit your commit message.

cz c

Built With

Docker

Docker is a software platform that allows you to quickly build, test, and deploy applications.

Make

Make is a tool which controls the generation of executables and other non-source files of a program from the program's source files.

Django

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design.

PostgreSQL

PostgreSQL is a powerful, open source object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.

Contributing

Issues

In the case of a bug report, bugfix or a suggestions, please feel very free to open an issue.

Pull request

Pull requests are always welcome, and I'll do my best to do reviews as fast as I can.

License

This project is licensed under the MIT License

Get Help

Acknowledgements

Django REST Framework - Django REST framework is a powerful and flexible toolkit for building Web APIs.