Test assignment for Canalservice
This project provides you a working Django environment without requiring you to install Python/Django, a web server, and any other server software on your local machine. For this, it requires Docker and Docker Compose.
-
Install Docker and Docker-compose;
-
Clone this project and then cd to the project folder;
-
Create your own .env file by copying .env.example:
$ cp src/.env.example src/.env
-
Update the environment variables in the docker-compose.yml and .env files.
-
Build the images and run the containers:
$ docker-compose -f docker-compose.yml up -d --build
-
You've done! Main page is available on http://localhost
-
After finishing work, you can stop running containers:
$ docker-compose down
To start parsing data from Google Sheets, go to http://localhost/gsheets
After running the script, you will be redirected to http://localhost/order-list to view the obtained data
If you change the data in Google Sheets, go to http://localhost/gsheets again to retrieve the changed data
To test using the webhook, you need to deploy the application on a server with the domain
-
Create an nginx configuration file to handle ssl:
$ mkdir conf.d $ cp ./Docker/nginx/nginx.prod.conf ./conf.d/nginx.conf
-
Update the environment variables:
2.1. In the docker-compose.yml variable "CERTBOT_EMAIL"
2.2. In the conf.d/nginx.conf variable "server_name"
2.3 In the src/.env add variable "CSRF_TRUSTED_ORIGINS=https://your_web_site"
-
Set up a webhook for your site with Apix-Drive.com
-
Build the images and run the containers:
$ docker-compose -f docker-compose.prod.yml up -d --build
-
You've done! Main page is available on https://your_web_site
This project is licensed under the MIT license.
My thanks to the developers of the Docker and Apix-Drive.com.