-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
52 lines (35 loc) · 989 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
43
44
45
46
47
48
49
50
51
52
# -*- coding: utf-8 -*-
"""
Set application deployment and system administration task scripts here
"""
STAGING = 'user@server'
PRODUCTION = 'user@server'
import logging
logging.basicConfig()
logging.getLogger('ssh.transport').setLevel(logging.ERROR)
from fabric.api import *
app_dir = '/var/sites/..'
VIRTUAlENV_PYTHON = '/home/webapp/..'
@task
def staging():
env.hosts = [STAGING]
@task
def production():
env.hosts = [PRODUCTION]
def venv_python(cmd):
run(VIRTUAlENV_PYTHON + ' ' + cmd)
@task
def deploy():
#First make sure that github is up to date
local("git pull")
local("git push origin master")
with cd(app_dir):
run('git pull')
venv_python('manage.py collectstatic -v0 --noinput')
venv_python('manage.py clear_cache')
migrate()
print "Server updated - reloading WSGI"
run('touch Edelfelt/wsgi.py')
def migrate():
with cd(app_dir):
venv_python('manage.py migrate -v0 --noinput')