-
Notifications
You must be signed in to change notification settings - Fork 94
/
demo.py
44 lines (32 loc) · 1.11 KB
/
demo.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
import os
import django
SETTINGS = "activflow.settings.development"
if os.environ.get("ENV", None) == "staging":
SETTINGS = "activflow.settings.staging"
os.environ['DJANGO_SETTINGS_MODULE'] = SETTINGS
def main():
"""Entry Point"""
print ('Setting Up demo...')
django.setup()
os.system('sudo rm db.sqlite3')
os.system('sudo rm -r activflow/core/migrations')
os.system('sudo rm -r activflow/tests/migrations')
os.system('./manage.py makemigrations core tests')
os.system('./manage.py migrate')
print ('Create Superuser...')
os.system('./manage.py createsuperuser [email protected]')
from django.contrib.auth.models import Group, User
submitter = Group.objects.create(name='Submitter')
reviewer = Group.objects.create(name='Reviewer')
john_doe = User.objects.create_user(
'john.doe',
'12345')
jane_smith = User.objects.create_user(
'jane.smith',
'12345')
submitter.user_set.add(john_doe)
reviewer.user_set.add(jane_smith)
if __name__ == '__main__':
main()