This repository has been archived by the owner on May 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
fabfile.py
51 lines (39 loc) · 2.22 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
from fabric.api import *
env.roledefs = {
'staging': [],
'production': [],
}
@roles('staging')
def deploy_staging():
# Remove this line when you're happy that this Fabfile is correct
raise RuntimeError("Please check the fabfile before using it")
base_dir = '/usr/local/django/{{ project_name }}wagtail/'
virtualenv_dir = '/usr/local/django/virtualenvs/{{ project_name }}wagtail/'
python = virtualenv_dir + '/bin/python'
pip = virtualenv_dir + '/bin/pip'
with cd(base_dir):
run('git pull origin master')
run(pip + ' install -r requirements.txt')
run(python + ' {{ project_name }}/manage.py migrate --settings={{ project_name }}.settings.production --noinput')
run(python + ' {{ project_name }}/manage.py collectstatic --settings={{ project_name }}.settings.production --noinput')
run(python + ' {{ project_name }}/manage.py compress --settings={{ project_name }}.settings.production')
run(python + ' {{ project_name }}/manage.py update_index --settings={{ project_name }}.settings.production')
# 'restart' should be an alias to a script that restarts the web server
run('restart')
@roles('production')
def deploy_production():
# Remove this line when you're happy that this Fabfile is correct
raise RuntimeError("Please check the fabfile before using it")
base_dir = '/usr/local/django/{{ project_name }}wagtail/'
virtualenv_dir = '/usr/local/django/virtualenvs/{{ project_name }}wagtail/'
python = virtualenv_dir + '/bin/python'
pip = virtualenv_dir + '/bin/pip'
with cd(base_dir):
run('git pull origin master')
run(pip + ' install -r requirements.txt')
run(python + ' {{ project_name }}/manage.py migrate --settings={{ project_name }}.settings.production --noinput')
run(python + ' {{ project_name }}/manage.py collectstatic --settings={{ project_name }}.settings.production --noinput')
run(python + ' {{ project_name }}/manage.py compress --settings={{ project_name }}.settings.production')
run(python + ' {{ project_name }}/manage.py update_index --settings={{ project_name }}.settings.production')
# 'restart' should be an alias to a script that restarts the web server
run('restart')