Created
April 9, 2012 22:49
-
-
Save jacobh/2347158 to your computer and use it in GitHub Desktop.
Super Simple Python CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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