You will need a Contentful OAuth Application to run this program. (Docs here)
Credentials live in app/config.json
, which should be structured like:
{
"contentful-space-id": "<contentful-space-id>",
"images-directory": "imgs",
"contentful-environment": "<contentful-environment>",
"contentful-client-id": "<contentful-client-id>",
"redirect-uri": "<redirect-uri>"
}
Python requirements live in requirements.txt
.
Install them with pip3 install -r requirements.txt
- Run the development server with
./develop
. (You may need tochmod +x develop.sh
first.) - Visit http://localhost:5000
Because Contentful requires HTTPS for its URI redirects, you'll need to be use a service like ngrok to run the development server. The development server runs on port 5000: you'll need to forward 5000 over http.
Keep in mind that you'll need to update the URI redirect in your OAuth application to the HTTPS proxy in order for the authentication workflow to work.
This project uses docker-compose
for containerization. There are three services:
nginx
, which runs on ports 80 and 443.flask_app
, the actual Flask application, runs on port 5000. (nginx
reverse proxies to0.0.0.0:5000
via uswgi.)certbot
, which handles HTTPS certificates.
(This configuration is based on wmnnd's boilerplate.)
sudo docker-compose up
should do the trick.
To update the codebase on the server, run:
git pull origin master
sudo docker-compose build
sudo docker-compose restart
Note thatrestart
does not reflect changes made todocker-compose.yml
.
Todo items are marked with todo
in the comments.
Try grep -r "todo"
to find outstanding items.
Code is formatted using yapf.
To format all files, run yapf . -i --recursive
from the root directory.