forked from adlnet/ADL_LRS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfabfile.py
More file actions
55 lines (42 loc) · 1.78 KB
/
fabfile.py
File metadata and controls
55 lines (42 loc) · 1.78 KB
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
import os
import sys
from fabric.api import local,run
def setup_env():
INSTALL_STEPS = ['virtualenv ../env;. ../env/bin/activate;pip install -r requirements.txt;deactivate']
for step in INSTALL_STEPS:
local(step)
def setup_lrs():
# Media folder names
agent_profile = 'agent_profile'
activity_profile = 'activity_profile'
activity_state = 'activity_state'
statement_attachments = 'attachment_payloads'
# Add env packages and project to the path
cwd = os.path.dirname(os.path.abspath(__file__))
if not cwd in sys.path:
sys.path.append(cwd)
env_dir = os.path.join(cwd, '../env/lib/python2.7/site-packages')
if not env_dir in sys.path:
sys.path.append(env_dir)
log_dir = os.path.join(cwd, '../logs')
if not os.path.exists(log_dir):
os.makedirs(log_dir)
# Add settings module so fab file can see it
os.environ['DJANGO_SETTINGS_MODULE'] = "adl_lrs.settings"
from django.conf import settings
adldir = settings.MEDIA_ROOT
# Create media directories
if not os.path.exists(os.path.join(adldir,activity_profile)):
os.makedirs(os.path.join(adldir,activity_profile))
if not os.path.exists(os.path.join(adldir,activity_state)):
os.makedirs(os.path.join(adldir,activity_state))
if not os.path.exists(os.path.join(adldir,agent_profile)):
os.makedirs(os.path.join(adldir,agent_profile))
if not os.path.exists(os.path.join(adldir,statement_attachments)):
os.makedirs(os.path.join(adldir,statement_attachments))
# Create cache tables and sync the db
local('./manage.py createcachetable cache_statement_list')
local('./manage.py createcachetable attachment_cache')
local('./manage.py syncdb')
def test_lrs():
local('./manage.py test lrs')