comparison fabfile.py @ 107:89d0511cb5c2

Update fabric file for production server (finally!).
author Brian Neal <bgneal@gmail.com>
date Tue, 15 Oct 2013 21:00:21 -0500
parents 1eb4b4072888
children
comparison
equal deleted inserted replaced
106:52d963f92251 107:89d0511cb5c2
1 from fabric.api import cd, env, local, put, run 1 from fabric.api import cd, run
2 2
3 PYTHON = '/svr/django-sites/bns/bin/python'
4 WC_DIR = '/svr/django-sites/bns/bravenewsurf'
5 PROJ_DIR = WC_DIR + '/bns_website'
3 6
4 def update(): 7 def update():
5 """ 8 """
6 Runs hg pull -u. 9 Runs hg pull -u.
7 10
8 """ 11 """
9 with cd('/home/var/django-sites/bns/bns/'): 12 with cd(WC_DIR):
10 run('hg pull -u') 13 run('hg pull --update')
11 14
12 15
13 def collectstatic(): 16 def collectstatic():
14 """ 17 """
15 Runs the staticfiles collectstatic command to deploy static assets. 18 Runs the staticfiles collectstatic command to deploy static assets.
16 19
17 """ 20 """
18 cmd = ('. ./env.bash && python manage.py collectstatic ' 21 cmd = ('%s manage.py collectstatic '
19 '--settings=settings.production --noinput') 22 '--settings=settings.production --noinput') % PYTHON
20 23
21 with cd('/home/var/django-sites/bns/bns/bns_website/'): 24 with cd(PROJ_DIR):
25 run(cmd)
26
27
28 def cleanup():
29 """
30 Runs the cleanup management command.
31
32 """
33 cmd = '%s manage.py cleanup --settings=settings.production' % PYTHON
34
35 with cd(PROJ_DIR):
22 run(cmd) 36 run(cmd)
23 37
24 38
25 def touch(): 39 def touch():
26 """ 40 """
27 Touches the wsgi file to reload the Python code. 41 Touches the wsgi file to reload the Python code.
28 42
29 """ 43 """
30 with cd('/home/var/django-sites/bns/bns/bns_website/'): 44 with cd(PROJ_DIR):
31 run('touch apache/bns.wsgi') 45 run('touch apache/bns.wsgi')