forked from opennorth/open13
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
38 lines (31 loc) · 864 Bytes
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
from fabric.api import *
@task
def prod():
env.hosts = ['open13.ca']
env.user = 'open13'
env.base_dir = '/home/open13'
_env_setup()
def _env_setup():
env.virtualenv_bin = os.path.join(env.base_dir, '.virtualenvs', 'open13', 'bin')
env.python = os.path.join(env.virtualenv_bin, 'python')
env.django_dir = os.path.join(env.base_dir, 'open13', 'website')
@task
def deploy():
pull()
statics()
reload()
@task
def pull():
with cd(os.path.join(env.base_dir, 'billy')):
run('git pull')
with cd(os.path.join(env.base_dir, 'open13')):
run('git pull')
@task
def statics():
with cd(env.django_dir):
run('%s manage.py collectstatic --noinput' % env.python)
@task
def reload():
with cd(env.base_dir):
run('kill -HUP `cat gunicorn/gunicorn.pid`')