-
Notifications
You must be signed in to change notification settings - Fork 16
/
fabfile.py
42 lines (26 loc) · 892 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
39
40
41
42
# -*- coding: utf-8 -*-
from fabric.api import cd, env, run
env.project_root = "/home/djangobrasil/djangobrasil.org"
env.app_root = env.project_root + "/src/djangobrasil"
env.virtualenv = "/home/djangobrasil/.virtualenvs/djangobrasil"
def update():
with cd(env.project_root):
run("git pull")
def deps():
run("{}/bin/pip install -r {}/requirements.txt".format(
env.virtualenv, env.project_root))
def start():
with cd(env.app_root):
run('%(virtualenv)s/bin/gunicorn_django -p gunicorn.pid \
--bind=127.0.0.1:7777--daemon --workers=3' % env)
def stop():
run('kill -TERM `cat %(app_root)s/gunicorn.pid`' % env)
def reload():
run('kill -HUP `cat %(app_root)s/gunicorn.pid`' % env)
def clean():
with cd(env.app_root):
run("find . -name \"*.pyc\" | xargs rm -f ")
def deploy():
update()
deps()
clean()