-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
manage.py
62 lines (47 loc) · 2.13 KB
/
manage.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
#!/usr/bin/env python
import os
import sys
from utils import dbcheck
# import settings
# os.environ("DJANGO_SETTINGS_MODULE", "YAPO.settings")
# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "YAPO.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "YAPO.settings")
def main_is_frozen ():
return (hasattr(sys, "frozen")) # old py2exe
def get_main_dir ():
if main_is_frozen():
return os.path.dirname(sys.executable)
return os.path.dirname(os.path.realpath(__file__))
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "YAPO.settings")
# import videos.apps
# import YAPO.pagination
# a = apps
# a = pagination
SCRIPT_ROOT = get_main_dir()
#dbcheck.boot()
try:
if sys.frozen or sys.importers:
SCRIPT_ROOT = os.path.dirname(sys.executable)
compiled = True
except AttributeError:
SCRIPT_ROOT = os.path.dirname(os.path.realpath(__file__))
compiled = False
from django.core.management import execute_from_command_line
from configuration import Config
# execute_from_command_line(sys.argv)
# print(sys.argv)
if not any(["migrate" in str(sys.argv), "makemigrations" in str(sys.argv), "loaddata" in str(sys.argv),
"dumpdata" in str(sys.argv), "shell" in str(sys.argv), "help" in str(sys.argv),
"dumpscript" in str(sys.argv), "sql" in str(sys.argv),
"showmigrations" in str(sys.argv), "runserver" in str(sys.argv),
"clean_pyc" in str(sys.argv), "check" in str(sys.argv), "get-clean-titles" in str(sys.argv),
"convert-tags" in str(sys.argv), "mark-scenes" in str(sys.argv)]):
print(f"Config: {Config().yapo_url}")
execute_from_command_line([SCRIPT_ROOT, 'runserver', Config().yapo_url, '--noreload'])
else:
#if not "runserver" in str(sys.argv):
# print("YAPO error -- started without a host in configuration file and without a job to do.\n")
# print("Specify if you wish to run the server, migrate, make migrations .\n")
# quit()
execute_from_command_line(sys.argv)