forked from pythonmg/python-mg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
57 lines (37 loc) · 1.08 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from fabric.api import env, run, cd, sudo
from decouple import config
env.hosts = [
config('DEPLOY_SERVER'),
]
env.password = config('DEPLOY_PASS')
PROJECT_PATH = u'/home/deploy/www/pugmg/project'
PYTHON_BIN = u'/home/deploy/.envs/pugmg/bin/python'
PIP_BIN = u'/home/deploy/.envs/pugmg/bin/pip'
def git(cmd):
with cd(PROJECT_PATH):
run("git %s" % cmd)
def pull():
git("pull --rebase origin master")
def manage(args):
with cd(PROJECT_PATH):
run("%s manage.py %s --settings=pymg.settings.production" % (
PYTHON_BIN, args))
def install_requirements():
with cd(PROJECT_PATH):
run("%s install -r requirements.txt" % PIP_BIN)
def reload_service():
sudo("supervisorctl reload pugmg")
def deploy():
pull()
install_requirements()
manage('syncdb --noinput')
manage('collectstatic --noinput')
reload_service()
def reset_feeds():
manage('sqlclear feeds')
manage('dbshell')
manage('syncdb')
manage('loaddata data/feeds.json')
manage('update_feeds')
def update_data():
manage('update_feeds')