· 8 years ago · Jun 16, 2017, 01:10 PM
1settings_local.py
2
3Alexander Pitkin, [16.06.17 12:50]
4# Django settings for quidlum_com project.
5import settings
6import os
7
8# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
9BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
10
11DEBUG = True
12TEMPLATE_DEBUG = DEBUG
13ALLOW_SIGNUP = True
14DEBUG_TOOLBAR_PATCH_SETTINGS = False
15GA_PROFILE_ID = 'ga:72031822'
16CORS_ORIGIN_ALLOW_ALL = True
17
18ADMINS = (
19 # ('Your Name', 'your_email@example.com'),
20)
21
22MANAGERS = ADMINS
23SOCIALACCOUNT_PROVIDERS = settings.SOCIALACCOUNT_PROVIDERS
24DATABASES = {
25 'default': {
26 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
27 'NAME': 'quidlum',
28 'USER': '',
29 'PASSWORD': '',
30 'HOST': "127.0.0.1",
31 'PORT': '5432',
32 }
33}
34
35# Local time zone for this installation. Choices can be found here:
36# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
37# although not all choices may be available on all operating systems.
38# In a Windows environment this must be set to your system time zone.
39TIME_ZONE = 'UTC'
40
41# Language code for this installation. All choices can be found here:
42# http://www.i18nguy.com/unicode/language-identifiers.html
43LANGUAGE_CODE = 'en-us'
44
45SITE_ID = 1
46
47# If you set this to False, Django will make some optimizations so as not
48# to load the internationalization machinery.
49USE_I18N = True
50
51# If you set this to False, Django will not format dates, numbers and
52# calendars according to the current locale.
53USE_L10N = True
54
55# If you set this to False, Django will not use timezone-aware datetimes.
56USE_TZ = True
57
58# Absolute filesystem path to the directory that will hold user-uploaded files.
59# Example: "/home/media/media.lawrence.com/media/"
60MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
61
62# URL that handles the media served from MEDIA_ROOT. Make sure to use a
63# trailing slash.
64# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
65# MEDIA_URL = 'https://quidlumdev.s3.amazonaws.com/media/'
66MEDIA_URL = '/media/'
67
68FILE_UPLOAD_PERMISSIONS = 0644
69# Absolute path to the directory static files should be collected to.
70# Don't put anything in this directory yourself; store your static files
71# in apps' "static/" subdirectories and in STATICFILES_DIRS.
72# Example: "/home/media/media.lawrence.com/static/"
73STATIC_ROOT = os.path.join(BASE_DIR, 'static')
74
75# URL prefix for static files.
76# Example: "http://media.lawrence.com/static/"
77STATIC_URL = '/static/'
78
79# Additional locations of static files
80STATICFILES_DIRS = (
81 # Put strings here, like "/home/html/static" or "C:/www/django/static".
82 # Always use forward slashes, even on Windows.
83 # Don't forget to use absolute paths, not relative paths.
84)
85
86Wikipedia
87List of tz database time zones
88This is a list of time zones in the tz database release 2017b. The list is derived from the zones, links, and rules specified in zone.tab and the 7 "c...
89 # List of finder classes that know how to find static files in
90# various locations.
91STATICFILES_FINDERS = (
92 'django.contrib.staticfiles.finders.FileSystemFinder',
93 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
94 # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
95)
96
97# Make this unique, and don't share it with anybody.
98SECRET_KEY = '@bm9#!lhv1o0gh86^%xtwf23&b7@46w6o2z_3j-@(#6fvjxi@e'
99
100# List of callables that know how to import templates from various sources.
101TEMPLATE_LOADERS = (
102 'django_mobile.loader.Loader',
103 'django.template.loaders.filesystem.Loader',
104 'django.template.loaders.app_directories.Loader',
105 # 'django.templates.loaders.eggs.Loader',
106 # 'coffin.template.loaders.',
107)
108
109Alexander Pitkin, [16.06.17 12:50]
110TEMPLATE_CONTEXT_PROCESSORS = (
111 # "cumulus.context_processors.cdn_url",
112 "django.contrib.auth.context_processors.auth",
113 "django.core.context_processors.debug",
114 "django.core.context_processors.i18n",
115 "django.core.context_processors.media",
116 "django.core.context_processors.static",
117 "django.core.context_processors.tz",
118 "django.contrib.messages.context_processors.messages",
119 "django.core.context_processors.request",
120 # "allauth.account.context_processors.account",
121 # "allauth.socialaccount.context_processors.socialaccount",
122 "django_mobile.context_processors.flavour",
123 "django.core.context_processors.csrf",
124
125)
126
127MIDDLEWARE_CLASSES = (
128 'django_hosts.middleware.HostsRequestMiddleware',
129 'corsheaders.middleware.CorsMiddleware',
130 'django.middleware.common.CommonMiddleware',
131 'django.contrib.sessions.middleware.SessionMiddleware',
132 'django.middleware.csrf.CsrfViewMiddleware',
133 'django.contrib.auth.middleware.AuthenticationMiddleware',
134 'django.contrib.messages.middleware.MessageMiddleware',
135 'django.middleware.clickjacking.XFrameOptionsMiddleware',
136 'django_mobile.middleware.MobileDetectionMiddleware',
137 'django_mobile.middleware.SetFlavourMiddleware',
138 'django_hosts.middleware.HostsResponseMiddleware',
139)
140if DEBUG:
141 MIDDLEWARE_CLASSES += (
142 'debug_toolbar.middleware.DebugToolbarMiddleware',
143 )
144ROOT_URLCONF = 'quidlum_com.urls'
145
146ROOT_HOSTCONF = 'quidlum_com.hosts'
147
148DEFAULT_HOST = 'dev'
149
150SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
151
152# Python dotted path to the WSGI application used by Django's runserver.
153WSGI_APPLICATION = 'quidlum_com.wsgi.application'
154
155TEMPLATE_DIRS = (
156 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
157 # Always use forward slashes, even on Windows.
158 # Don't forget to use absolute paths, not relative paths.
159)
160
161INSTALLED_APPS = settings.INSTALLED_APPS
162
163AUTHENTICATION_BACKENDS = (
164 # Needed to login by username in Django admin, regardless of allauth
165 "django.contrib.auth.backends.ModelBackend",
166
167 # allauth specific authentication methods, such as login by e-mail
168 "allauth.account.auth_backends.AuthenticationBackend",
169)
170
171# A sample logging configuration. The only tangible logging
172# performed by this configuration is to send an email to
173# the site admins on every HTTP 500 error when DEBUG=False.
174# See http://docs.djangoproject.com/en/dev/topics/logging for
175# more details on how to customize your logging configuration.
176'''LOGGING = {
177 'version': 1,
178 'disable_existing_loggers': False,
179 'filters': {
180 'require_debug_false': {
181 '()': 'django.utils.log.RequireDebugFalse'
182 }
183 },
184 'handlers': {
185 'mail_admins': {
186 'level': 'ERROR',
187 'filters': ['require_debug_false'],
188 'class': 'django.utils.log.AdminEmailHandler'
189 }
190 },
191 'loggers': {
192 'django.request': {
193 'handlers': ['mail_admins'],
194 'level': 'ERROR',
195 'propagate': True,
196 },
197 }
198}'''
199 Alexander Pitkin, [16.06.17 12:50]
200LOGGING = {
201 'version': 1,
202 'disable_existing_loggers': True,
203 'formatters': {
204 'standard': {
205 'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
206 'datefmt': "%d/%b/%Y %H:%M:%S"
207 },
208 },
209 'handlers': {
210 'null': {
211 'level': 'DEBUG',
212 'class': 'django.utils.log.NullHandler',
213 },
214 'logfile': {
215 'level': 'DEBUG',
216 'class': 'logging.handlers.RotatingFileHandler',
217 'filename': "logfile",
218 'maxBytes': 50000,
219 'backupCount': 2,
220 'formatter': 'standard',
221 },
222 'console': {
223 'level': 'INFO',
224 'class': 'logging.StreamHandler',
225 'formatter': 'standard'
226 },
227 },
228 'loggers': {
229 'django': {
230 'handlers': ['console'],
231 'propagate': True,
232 'level': 'WARN',
233 },
234 'django.db.backends': {
235 'handlers': ['console'],
236 'level': 'DEBUG',
237 'propagate': False,
238 },
239 'celery': {
240 'handlers': ['logfile', 'console'],
241 'level': 'DEBUG',
242 },
243 '': {
244 'handlers': ['console', 'logfile'],
245 'level': 'DEBUG',
246 },
247 }
248}
249CELERY_RESULT_BACKEND = 'djcelery.backends.database:DatabaseBackend'
250# Authaticate using custom user model
251AUTH_USER_MODEL = 'qcore.QUser'
252
253# login url
254LOGIN_URL = '/'
255LOGIN_REDIRECT_URL = '/'
256
257# allauth settings
258ACCOUNT_AUTHENTICATION_METHOD = "email"
259ACCOUNT_DEFAULT_HTTP_PROTOCOL = "http"
260ACCOUNT_EMAIL_REQUIRED = True
261ACCOUNT_EMAIL_VERIFICATION = "optional"
262ACCOUNT_SIGNUP_FORM_CLASS = 'qcore.forms.SignupForm'
263ACCOUNT_USERNAME_REQUIRED = False
264ACCOUNT_PASSWORD_MIN_LENGTH = 8
265SOCIALACCOUNT_QUERY_EMAIL = True
266SOCIALACCOUNT_AUTO_SIGNUP = True
267# NEXT variable fix:
268ACCOUNT_ADAPTER = 'qcore.overloads.NextFixAdapter'
269
270# # Email settings
271# EMAIL_HOST = 'smtp.gmail.com'
272# EMAIL_PORT = 587
273# EMAIL_HOST_USER = 'noreply@quidlum.com'
274# EMAIL_HOST_PASSWORD = 'tGI48uUxYRj53fj17AR6'
275# EMAIL_USE_TLS = True
276
277# BROKER_URL = 'amqp://quidlum-task:bMzMTbg7ZVBhcbEewaYs@ip-172-31-8-35.us-west-2.compute.internal:5672/dev_tasks'
278
279# DEFAULT_FILE_STORAGE = 'quidlum_com.s3utils.MediaS3BotoStorage'
280# STATICFILES_STORAGE = 'quidlum_com.s3utils.StaticS3BotoStorage'
281
282# AWS_ACCESS_KEY_ID = 'AKIAJSG5SPYPW4XBUKXQ'
283# AWS_SECRET_ACCESS_KEY = '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'
284# AWS_STORAGE_BUCKET_NAME = 'quidlumdev'
285# AWS_QUERYSTRING_AUTH = False
286
287NOTIFICATIONS_USE_JSONFIELD = True
288
289if DEBUG:
290 def show_toolbar(request):
291 return True
292
293
294 DEBUG_TOOLBAR_PANELS = [
295 'debug_toolbar.panels.versions.VersionsPanel',
296 'debug_toolbar.panels.timer.TimerPanel',
297 'debug_toolbar.panels.settings.SettingsPanel',
298 'debug_toolbar.panels.headers.HeadersPanel',
299 'debug_toolbar.panels.request.RequestPanel',
300 'debug_toolbar.panels.sql.SQLPanel',
301 # 'debug_toolbar.panels.staticfiles.StaticFilesPanel',
302 'debug_toolbar.panels.templates.TemplatesPanel',
303 'debug_toolbar.panels.cache.CachePanel',
304 # 'debug_toolbar.panels.signals.SignalsPanel',
305 # 'debug_toolbar.panels.logging.LoggingPanel',
306 # 'debug_toolbar.panels.redirects.RedirectsPanel',
307 'debug_toolbar.panels.profiling.ProfilingPanel',
308 ]
309 Alexander Pitkin, [16.06.17 12:50]
310DEBUG_TOOLBAR_CONFIG = {
311 # ...
312 'SHOW_TOOLBAR_CALLBACK': "%s.show_toolbar" % __name__,
313 'DISABLE_PANELS': set(['debug_toolbar.panels.versions.VersionsPanel',
314 'debug_toolbar.panels.timer.TimerPanel',
315 'debug_toolbar.panels.settings.SettingsPanel',
316 'debug_toolbar.panels.headers.HeadersPanel',
317 'debug_toolbar.panels.request.RequestPanel',
318 'debug_toolbar.panels.sql.SQLPanel',
319 # 'debug_toolbar.panels.staticfiles.StaticFilesPanel',
320 'debug_toolbar.panels.templates.TemplatesPanel',
321 'debug_toolbar.panels.cache.CachePanel',
322 # 'debug_toolbar.panels.signals.SignalsPanel',
323 # 'debug_toolbar.panels.logging.LoggingPanel',
324 # 'debug_toolbar.panels.redirects.RedirectsPanel',
325 'debug_toolbar.panels.profiling.ProfilingPanel', ])
326 }