GUNICORN=/usr/bin/gunicorn ROOT=/your/app/path PID=/var/run/gunicorn/your.pid APP=run:app if [ -f $PID ]; then rm $PID; fi cd $ROOT source venv/bin/activate exec $GUNICORN -c $ROOT/gunicorn.conf.py –pid=$PID $APP #coding: utf-8 from fabric.api import run,env,local,settings from fabric.operations import sudo from fabric.context_managers import cd import os import subprocess from fabric.api import e