A Backend python project, using django and django rest framework to build the api, connected with a postgresql database.
See the frontend project (procon_simplificado_react)
Use the Dockerfile to build the image.
Expose the port 8000.
Container volume | optional | description |
---|---|---|
/static | no | You need map this folder to a webserver, to serve the static files. On the start of the container, it will verify if the static folder is empty, and if so, will collect the static files. |
/code | yes | The python code of the project. This folder can be mapped if you want to change the code on the fly, without rebuilding the docker. |
Enviroment | default | optional | description |
---|---|---|---|
SECRET_KEY | secretkeyissecret | yes (at your on risk) | secret key for your django project. Please change this! |
ALLOWED_HOSTS | * | yes (at your on risk) | allowed urls to your backend |
DEBUG | 1 | yes (please change in production) | 0 => debug off, 1 => debug on |
DJANGO_MANAGEPY_MIGRATE | off | yes | change to on with you want to make a migrate on the start of the container |
PG_DB_HOST | changeme | no | Host of your database (postgresql), without port |
PG_DB_PORT | 5432 | yes | Port for your database |
PG_DB_USER | changeme | no | Name of the user to access the database |
PG_DB_PASSWORD password | changeme | no | password to access the database |
PG_DB_NAME event_tracker | changeme | no | Name of the database |
CORS_ALLOWED_ORIGINS | no | Endpoint of your frontend. To allow communication between diferent domains or subdomains. Can be multiple addresses separated with a comma (https://domainone.com,https://domaintwo.com) |
Connect to the api container, and create a superuser.
python /code/manage.py createsuperuser
Connect to the database container, and create the database.
psql -U user
CREATE DATABASE name;