The backend of this project is run based on docker and docker-compose.
Please install docker at https://docs.docker.com/install/
and docker-compose at https://docs.docker.com/compose/install/
.
-
Copy the
.env.example
file available and create an.env
file at the same directory. Update the fields accordingly for secret data. -
docker-compose --env-file .env config
- This command will configure the
docker-compose.yml
by taking in the environment variables stated in.env
- Note: please ensure to install docker-compose version 1.8+ for the config to work properly
- This command will configure the
-
docker-compose up --force-recreate
-
This will start the process of building the backend image from the source Python 3.6 base image, and installing pip packages stated inside the
requirements.txt
file.- Please refer to
Dockerfile
for more details. - All codes will be mounted as a volume inside the
/code
directory.
- Please refer to
-
A PostgreSQL base image will also be pulled from the docker registry.
-
After building the image, the processes will be started as stated in the
docker-compose.yml
file.- Upon starting up, a data migration will be carried out based on the migrations stated inside the
migrations
folder. - Upon starting up, a loaddata will also be done using the following command:
python ./manage.py loaddata booking/fixtures/data.json
. If you do not wish to have this be done, please comment out this line. - A
--force-recreate
flag is set when callingdocker-compose up
to prevent data from being uploaded multiple times. You can remove this as well.
- Upon starting up, a data migration will be carried out based on the migrations stated inside the
-
-
Visit APIs documentation at
localhost:8000/swagger/
-
To list running docker containers, you can run
docker ps
, note the container id stated in the output. -
To execute commands inside the image, you can run
docker exec -it <container_id> bash
then run whatever commands you need.If you would like to run the test cases, run
python manage.py test
after getting into the backend image.
Run the codes as stated in the frontend README.md
.
- This project uses Django-Rest-Framework to deploy REST API.
- The database used is Postgresql. The ORM comes with Django is being used.
drf-yasg
is used to run Swagger for API documentation.