JoelBorrero / bienestar_api

This is the backend rest api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django Docker Full - by osw4l

enter image description here

It is a beautiful Django image simple to configure, run and deploy, it was made with a lot of love and dedicated for humans who love django and simple things.

this project contains the next libraries

and more pretty stuff like

  • Docker compose
  • Daphne
  • UWSGI (no gunicorn)
  • Postgis as Database
  • Geo Django
  • Leaflet and Google Maps
  • Django Admin Themes
  • Celery Worker and Celery Beat
  • Nginx with django static files support
  • Static files working fine !
  • AWS S3 Storage
  • Natural structure, like you weren't using docker
  • Production deploy steps click here

Django Rest Framework Swagger

the project contains its own auth backend with register, login and reset password

enter image description here

Each endpoint contains its own serializer and swagger collection enter image description here

enter image description here

if you want to disable the register and the confirmation after register you have to go to setup in the admin

http://localhost:4500/admin/

Go to main and then go to setup

enter image description here

enter image description here Now go to the detail

I'll disabled the register for now

enter image description here

Then if I try to register in the register endpoint this gonna be the result

enter image description here

Django Google Maps Widget

enter image description here

Django Leaflet

enter image description here

enter image description here

Django Admin custom themes by django-admin-interface

enter image description here

Custom Commands

enter image description here

to use the custom commands just give permissions

Command to collect Statics

chmod +x run_collect_static.sh

Command to make migrations and migrate

chmod +x run_migrate.sh

Command to create super user

chmod +x run_create_user.sh

Command to load django admin themes

chmod +x run_theme.sh

Simple and beautiful structure

enter image description here
to run the image follow the next instructions, just for local environment

Create Environment file

cp env_template .env

Build image

docker compose build

Up image

 docker compose up -d

Migrations

you can create migrations and migrate the new models changes using the custom commands

this command just run migrate command

 docker compose exec backend python3 manage.py migrate

this command just run makemigrations and migrate commands

./run_migrate.sh

Restart Celery Beat

 docker compose restart beat

Create Superuser

command

docker compose exec backend python3 manage.py createsuperuser

sh file

./run_create_user.sh

Collect statics

this command just works in local doesn't work in production

docker compose exec backend python3 manage.py collectstatic  

this command works in local and production

sh file

./run_collect_static.sh

Load Django Admin Themes

./run_theme.sh

Pycharm Support first, we need to setup the common stuff to active the autocomplete adding the Django Support choosing the manage.py and settings.py files location.

enter image description here
now we need add the python interpreter what live inside the docker container to the project

Go to preferences and to click in Interpreter then in Project Interpreter and press add

enter image description here
now, do click in Docker, select the image what contains the project name, then write python3 and press ok

enter image description here
press apply and ok, done!.

enter image description here
now we have configured the interpreter what lives inside our Docker Container in our project

Please, DON'T UPDATE THE DEPENDENCIES ! unless necessary

if you wanna deploy this project in production, go to here

Thanks for using my project, if you need something else, feel you free to contact me ioswxd@gmail.com

Enjoy the project πŸ₯³ 🟑 πŸ”΅ πŸ’› πŸ’™ πŸ’Ÿ

About

This is the backend rest api


Languages

Language:Python 95.3%Language:HTML 2.0%Language:Dockerfile 1.6%Language:Shell 1.1%