-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathupgrade.py
28 lines (27 loc) · 872 Bytes
/
upgrade.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
import os
import pathlib
import shutil
import sys
print("*** Upgrading Python environment ***")
status = os.system(sys.executable + " -mpip install --upgrade -r requirements.txt")
if status != 0:
sys.exit(status)
print("*** Migrating server database ***")
status = os.system(sys.executable + " manage.py makemigrations flextool3")
if status != 0:
sys.exit(status)
status = os.system(sys.executable + " manage.py migrate")
if status != 0:
sys.exit(status)
print("*** Upgrading master project ***")
status = os.system("git submodule update")
if status != 0:
sys.exit(status)
print("*** Collecting static files ***")
static_dir = pathlib.Path(__file__).parent / "static"
if static_dir.exists():
shutil.rmtree(static_dir)
static_dir.mkdir(exist_ok=True)
status = os.system(sys.executable + " manage.py collectstatic")
if status != 0:
sys.exit(status)