-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
34 lines (27 loc) · 1.09 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jack River'
import os
import sys
BASE_DIR = os.path.dirname(__file__)
sys.path.insert(0, BASE_DIR)
from fabric.api import *
from fabric.context_managers import shell_env
def init_all(environment='Prod'):
""" initialize project
:param environment: DJANGO_CONFIGURATION settings, Prod or Dev
"""
if not environment:
sys.stderr.write('\nYou have to define the runtime environment: Prod/Dev\n')
with lcd(BASE_DIR):
with shell_env(DJANGO_CONFIGURATION=environment):
# syncdb and migrate
local('python manage.py syncdb')
local('python manage.py migrate')
sys.stdout.write('\nDatabase synced, initializing default site for you now.\n')
# create default site
local('python manage.py create_default_site')
sys.stdout.write('\nSite created, please change domain name to yours.\n')
sys.stdout.write(
'If you want to use social account login, please add a Social App for each OAuth based provider.\n'
)