Flask Deployment with Fabric

Tuesday September 25, 2018

I've been playing around with Flask lately, and deployment became a major bottleneck in my work-run cycle. I use Digital Ocean, which is cheap, simple, and has a great Community section full of tutorials. Still, when developing your own app this is far from a one-click setup out of the box.

I've found Fabric to be a simple way to automate tedious tasks and take ownership over the deployment process. Below is a gist of my rudimentary fabfile.py with tasks for creating, initializing, and destorying droplets. This setup uses NginX + Gunicorn to serve the Flask app.