Skip to content

Instantly share code, notes, and snippets.

@jacobh
Created April 9, 2012 22:49
Show Gist options
  • Save jacobh/2347158 to your computer and use it in GitHub Desktop.
Save jacobh/2347158 to your computer and use it in GitHub Desktop.
Super Simple Python CI
PID_FILE="/tmp/gunicorn_photokarma"
echo "pulling changes"
git pull
echo "checking for new pip deps"
pip install -r requirements.txt
echo "collecting static files"
python manage.py collectstatic --noinput
if [ -f $PID_FILE ] ;
then
echo 'restarting gunicorn'
kill -HUP `cat $PID_FILE`
else
echo "launching gunicorn"
gunicorn_django -w8 -p $PID_FILE -D
fi
echo "done!"
from flask import Flask
from subprocess import call
from os import chdir, kill
app = Flask(__name__)
project_location = '/home/Photokarma'
@app.route('/security-through-obscurity', methods=['GET', 'POST'])
def run_update():
print 'chdir\'ing'
chdir(project_location)
print 'running launch script'
call(['./run.sh',], shell=True)
return 'success'
if __name__ == "__main__":
app.run(host='0.0.0.0')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment