-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdemo_project.py
34 lines (28 loc) · 910 Bytes
/
demo_project.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
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import sys
sys.dont_write_bytecode = True
MISSING_DEPENDENCIES = []
try:
from django.conf import settings
except ImportError:
MISSING_DEPENDENCIES.append("Django\>=1.11")
try:
from os import scandir
except ImportError:
try:
from scandir import scandir
except ImportError:
MISSING_DEPENDENCIES.append("scandir\>=1.5")
if MISSING_DEPENDENCIES:
deps = " ".join(MISSING_DEPENDENCIES)
sys.stdout.write("You'll need to `pip install {}` to run this demo\n".format(deps))
sys.exit(1)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
if __name__ == "__main__":
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)