changeset 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 52d963f92251
children 9ca05ec9b64e
files fabfile.py
diffstat 1 files changed, 21 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/fabfile.py	Tue Oct 15 20:51:35 2013 -0500
+++ b/fabfile.py	Tue Oct 15 21:00:21 2013 -0500
@@ -1,13 +1,16 @@
-from fabric.api import cd, env, local, put, run
+from fabric.api import cd, run
 
+PYTHON = '/svr/django-sites/bns/bin/python'
+WC_DIR = '/svr/django-sites/bns/bravenewsurf'
+PROJ_DIR = WC_DIR + '/bns_website'
 
 def update():
     """
     Runs hg pull -u.
 
     """
-    with cd('/home/var/django-sites/bns/bns/'):
-        run('hg pull -u')
+    with cd(WC_DIR):
+        run('hg pull --update')
 
 
 def collectstatic():
@@ -15,10 +18,21 @@
     Runs the staticfiles collectstatic command to deploy static assets.
 
     """
-    cmd = ('. ./env.bash && python manage.py collectstatic '
-        '--settings=settings.production --noinput')
+    cmd = ('%s manage.py collectstatic '
+        '--settings=settings.production --noinput') % PYTHON
 
-    with cd('/home/var/django-sites/bns/bns/bns_website/'):
+    with cd(PROJ_DIR):
+        run(cmd)
+
+
+def cleanup():
+    """
+    Runs the cleanup management command.
+
+    """
+    cmd = '%s manage.py cleanup --settings=settings.production' % PYTHON
+
+    with cd(PROJ_DIR):
         run(cmd)
 
 
@@ -27,5 +41,5 @@
     Touches the wsgi file to reload the Python code.
 
     """
-    with cd('/home/var/django-sites/bns/bns/bns_website/'):
+    with cd(PROJ_DIR):
         run('touch apache/bns.wsgi')