forked from Pierre-Sassoulas/django-survey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
157 lines (131 loc) · 4.59 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
146
147
148
149
150
151
152
153
154
155
156
157
import logging
import os
try:
import colorama
except ImportError:
from pip._vendor import colorama
colorama.init()
print(
"\033[33m"
"You're using a dev settings file. It includes django rosetta (in order "
" for dev to update translations) that is only useful for dev. "
"If you're a developper you need to 'pip3 install -e \".[dev]\"', "
"If you want to use the app without doing your own settings you should"
" remove django-rosetta from the installed apps in the settings."
"\033[39m"
)
DEBUG = True
ROOT = os.path.dirname(os.path.abspath(__file__))
CSV_DIRECTORY = os.path.join(ROOT, "csv")
TEX_DIRECTORY = os.path.join(ROOT, "tex")
logging.basicConfig(level=logging.DEBUG, format="%(name)s.%(funcName)s() l.%(lineno)s -\033[32m %(message)s \033[39m")
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3", # Add 'postgresql_psycopg2',
# 'mysql', 'sqlite3' or 'oracle'
"NAME": "survey.db", # Or path to database file if using sqlite3
"USER": "", # Not used with sqlite3
"PASSWORD": "", # Not used with sqlite3.
"HOST": "", # Set to empty string for localhost. Not used with sqlite3
"PORT": "", # Set to empty string for default. Not used with sqlite3
}
}
USER_DID_NOT_ANSWER = "Left blank"
TEX_CONFIGURATION_FILE = os.path.join(ROOT, "doc", "example_conf.yaml")
SURVEY_DEFAULT_PIE_COLOR = "red!50"
CHOICES_SEPARATOR = ","
SITE_ID = 1
TIME_ZONE = "UTC"
USE_I18N = True
USE_L10N = True
USE_TZ = True
DEFAULT_SURVEY_PUBLISHING_DURATION = 7 # in days
MEDIA_URL = "/media/"
STATIC_URL = "/static/"
MEDIA_ROOT = os.path.join(ROOT, "media")
STATIC_ROOT = os.path.join(ROOT, "static")
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
)
DEBUG_ADMIN_NAME = "test_admin"
DEBUG_ADMIN_PASSWORD = "test_password"
STATICFILES_DIRS = [os.path.normpath(os.path.join(ROOT, "..", "survey", "static"))]
# Make this unique, and don't share it with anybody.
SECRET_KEY = "js*79rk(+s+x9)8co+10$zghe2f)+33jd1l2m#f)vl+pvtj24e"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [os.path.join(ROOT, "survey", "templates"), os.path.join(ROOT, "dev", "templates")],
"APP_DIRS": True,
"OPTIONS": {
"debug": DEBUG,
"context_processors": [
# Default
"django.contrib.auth.context_processors.auth",
"django.template.context_processors.debug",
"django.template.context_processors.i18n",
"django.template.context_processors.media",
"django.template.context_processors.static",
"django.template.context_processors.tz",
"django.template.context_processors.request",
"django.contrib.messages.context_processors.messages",
],
},
}
]
MIDDLEWARE = (
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
)
ROOT_URLCONF = "urls"
WSGI_APPLICATION = "wsgi.application"
INSTALLED_APPS = (
"django.contrib.admin",
"django.contrib.admindocs",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sites",
"survey",
"bootstrapform",
"rosetta",
)
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
LOCALE_PATHS = (os.path.join(ROOT, "survey", "locale"),)
LANGUAGE_CODE = "en-us"
LANGUAGES = (
("en", "english"),
("ru", "russian"),
("es", "spanish"),
("fr", "french"),
("ja", "Japanese"),
("nl", "Dutch"),
("zh", "Chinese"),
("de", "German"),
("id", "Indonesian"),
("pt", "Portuguese"),
("pl", "Polish"),
("tr", "Turkish"),
)
LOGIN_REDIRECT_URL = "/"
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"filters": {"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}},
"handlers": {
"mail_admins": {
"level": "ERROR",
"filters": ["require_debug_false"],
"class": "django.utils.log.AdminEmailHandler",
}
},
"loggers": {"django.request": {"handlers": ["mail_admins"], "level": "ERROR", "propagate": True}},
}