2012-03-12 21:16:19 -07:00
|
|
|
from fabric.api import cd, local, env, run, sudo
|
2011-10-23 20:13:37 -07:00
|
|
|
|
2012-04-26 19:49:43 -07:00
|
|
|
import datetime
|
|
|
|
|
2011-10-23 20:07:59 -07:00
|
|
|
|
2012-04-08 14:41:25 -07:00
|
|
|
env.hosts = ['nick@snipt.net:39039']
|
2012-03-05 13:48:03 -08:00
|
|
|
env.site_path = '/var/www/snipt'
|
2012-03-05 13:57:18 -08:00
|
|
|
env.venv_path = '/home/nick/.virtualenvs/snipt'
|
2012-01-25 07:20:52 -08:00
|
|
|
|
2012-03-05 13:57:18 -08:00
|
|
|
def _python(cmd):
|
|
|
|
return env.venv_path.rstrip('/') + '/bin/python ' + cmd
|
|
|
|
|
2012-04-29 08:03:17 -07:00
|
|
|
def dep():
|
2012-03-05 13:48:03 -08:00
|
|
|
local('python manage.py collectstatic --ignore grappelli --ignore admin --noinput')
|
2012-03-05 13:57:18 -08:00
|
|
|
|
2012-04-07 16:17:27 -07:00
|
|
|
try:
|
2012-04-29 08:14:33 -07:00
|
|
|
local('git push && ./get-last-commit-url.py')
|
2012-04-07 16:17:27 -07:00
|
|
|
except:
|
|
|
|
pass
|
2012-03-05 13:57:18 -08:00
|
|
|
|
2012-03-05 13:48:03 -08:00
|
|
|
with cd(env.site_path):
|
2012-04-29 08:05:07 -07:00
|
|
|
run('git pull')
|
2012-03-05 13:57:18 -08:00
|
|
|
run(_python('manage.py collectstatic --ignore grappelli --ignore admin --noinput'))
|
|
|
|
|
2012-03-12 21:16:19 -07:00
|
|
|
def re():
|
|
|
|
with cd(env.site_path):
|
2012-04-29 08:03:08 -07:00
|
|
|
run('./gk')
|
|
|
|
run('/home/nick/.virtualenvs/snipt/bin/python /home/nick/.virtualenvs/snipt/bin/gunicorn -c gunicorn.conf.py debug_wsgi:application')
|
2012-04-26 19:49:43 -07:00
|
|
|
|
|
|
|
def db_backup():
|
|
|
|
|
|
|
|
filename = datetime.datetime.now().strftime('%m-%d-%y')
|
|
|
|
|
|
|
|
print filename
|
|
|
|
|
|
|
|
#run('pg_dump snipt > snipt.pgdump')
|
|
|
|
|
|
|
|
#conn = S3Connection('AKIAJJRRQPTSPKB7GYOA', 'DIYz2g5vPjcWE4/YI7wEuUVAskwJxs2llFvGyI1a')
|
|
|
|
#snipt_bucket = conn.get_bucket('snipt')
|
|
|
|
|
|
|
|
#k = Key(snipt_bucket)
|
|
|
|
#k.set_contents_from_filename('snipt.pgdump')
|