-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
76 lines (54 loc) · 1.87 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
from __future__ import with_statement
from fabric.api import *
server_test = ['[email protected]']
####################################
########### REMOTE UTILS ###########
####################################
# Deploy sprint-x
@hosts(server_test)
def deploy_sprint(sprint_number):
with cd('/var/www/contact-tools'):
run('git checkout sprint-%s' % sprint_number)
run('git pull')
run('service apache2 reload')
@hosts(server_test)
def view_test_log():
run('tail -f /var/log/apache2/contact-tools-error.log')
####################################
########### DJANGO UTILS ###########
####################################
def install():
local('pip install -r requirements.txt')
def install_static():
local('python ./manage.py collectstatic')
def check_deploy():
local('python manage.py check --deploy')
def create_setting():
local('cp contacttools/local_settings.py-example contacttools/local_settings.py')
def req_pop():
local('pip freeze > requirements.txt')
def load_db():
local('python manage.py loaddata db.json')
def migrate():
local('python manage.py migrate')
def migrate_contacts():
local('python manage.py makemigrations contacts')
#fab migrate_app:'APP-NAME'
def migrate_app(app_name):
local('python manage.py makemigrations %s' % app_name)
def migrate_all():
local('python manage.py makemigrations contacts')
local('python manage.py migrate')
def create_superuser():
local('python manage.py createsuperuser')
def start():
local('python manage.py runserver 0.0.0.0:8000')
def run_test():
local('python manage.py test contacts')
####################################
########## DOCUMENTATION ###########
####################################
def start_doc():
local('mkdocs serve -f documentation/mkdocs.yml')
def deploy_doc():
local('mkdocs gh-deploy --clean -f documentation/mkdocs.yml')