-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboot_django.py
35 lines (30 loc) · 927 Bytes
/
boot_django.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
# File sets up the django environment, used by other scripts that need to
# execute in django land
import os
import django
from django.conf import settings
APP_NAME = "crawfish"
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), APP_NAME))
MIDDLEWARE = [
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
]
def boot_django():
settings.configure(
APP_ENVIRONMENT="test",
BASE_DIR=BASE_DIR,
DEBUG=True,
DEFAULT_AUTO_FIELD="django.db.models.AutoField",
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
},
MIDDLEWARE=MIDDLEWARE,
ROOT_URLCONF="tests.urls",
INSTALLED_APPS=(APP_NAME,),
TIME_ZONE="UTC",
USE_TZ=True,
)
django.setup()