-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py
145 lines (112 loc) · 3.78 KB
/
settings.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import os
import uuid
import logging
import mimetypes
import sys
from pathlib import Path
logger = logging.getLogger(__name__)
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s %(levelname)s %(message)s',
)
logger.info("Starting HMS-APP django:settings.py")
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
TEMPLATE_ROOT = os.path.join(PROJECT_ROOT, 'templates/')
DEPLOY_ENV = os.getenv("DEPLOY_ENV", "kube-dev")
#sys.path.insert(0, str(Path(__file__).parent.parent))
logger.info(f"PROJECT_ROOT: {PROJECT_ROOT}")
logger.info(f"TEMPLATE_ROOT: {TEMPLATE_ROOT}")
logger.info(f"DEPLOY_ENV: {DEPLOY_ENV}")
if "kube" not in DEPLOY_ENV.lower():
DEBUG = True
CORS_ORIGIN_ALLOW_ALL = True
else:
DEBUG = False
CORS_ORIGIN_ALLOW_ALL = False
logger.info(f"DEBUG: {DEBUG}, CORS_ORIGIN_ALLOW_ALL: {CORS_ORIGIN_ALLOW_ALL}")
mimetypes.add_type("application/javascript", ".js", True)
ALLOWED_HOSTS = ['*']
APPEND_SLASH = True
WQ_APP = bool(os.getenv("HMS_WQ_AP", "false").lower() == "true")
logger.info(f"WB app active: {WQ_APP}")
HMS_PUBLIC = bool(os.getenv("HMS_RELEASE", "False").lower() == "true")
logger.info(f"HMS Public configuration: {HMS_PUBLIC}")
ADMINS = (
('Deron Smith', 'smith.deron@epa.gov'),
('Kurt Wolfe', 'wolfe.kurt@epa.gov'),
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(TEMPLATE_ROOT),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
}
}
]
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'hms_app',
'corsheaders'
)
MIDDLEWARE = [
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
# 'hms_app.request_sanitize.SanitizeMiddleware'
]
ROOT_URLCONF = 'urls'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_ROOT, 'db.sqlite3'),
},
}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'America/New_York'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
STATIC_ROOT = os.path.join(PROJECT_ROOT, "collected_static/hms")
STATIC_URL = '/hms/static/'
# Define ENVIRONMENTAL VARIABLES
os.environ.update({
'PROJECT_PATH': PROJECT_ROOT,
'SITE_SKIN': 'EPA', # Leave empty ('') for default skin, 'EPA' for EPA skin
'CONTACT_URL': 'https://www.epa.gov/research/forms/contact-us-about-epa-research',
})
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SECRET_KEY = str(os.getenv('SECRET_KEY', uuid.uuid1()))
WSGI_APPLICATION = 'wsgi.application'
logger.info("This file has been modified")