Skip to content

Instantly share code, notes, and snippets.

@samalba
Last active December 14, 2015 14:29
Show Gist options
  • Save samalba/5101010 to your computer and use it in GitHub Desktop.
Save samalba/5101010 to your computer and use it in GitHub Desktop.
Run gunicorn for a Python app on dotCloud using a custom service.
#!/bin/bash
cd $SERVICE_APPROOT
[ -d ~/env ] ||
virtualenv --python=python2.7 ~/env || exit 1
. ~/env/bin/activate
[ -f requirements.txt ] &&
pip install --download-cache=~/.pip-cache -r requirements.txt || exit 1
cp -R * ~/
cat > ~/profile << ENDPROFILE
. ~/env/bin/activate
export PYTHONPATH=~/
ENDPROFILE
api:
type: custom
buildscript: ./build.sh
processes:
# If you don't need websocket, remove the `-k' option and its argument.
api: gunicorn -b 0.0.0.0:$PORT_WWW -w 8 -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker wsgi:app
ports:
www: http
gunicorn
gevent-websocket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment