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.examplefile available and create an.envfile at the same directory. Update the fields accordingly for secret data. -
docker-compose --env-file .env config- This command will configure the
docker-compose.ymlby 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.txtfile.- Please refer to
Dockerfilefor more details. - All codes will be mounted as a volume inside the
/codedirectory.
- 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.ymlfile.- Upon starting up, a data migration will be carried out based on the migrations stated inside the
migrationsfolder. - 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-recreateflag is set when callingdocker-compose upto 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> bashthen run whatever commands you need.If you would like to run the test cases, run
python manage.py testafter 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-yasgis used to run Swagger for API documentation.