· 7 years ago · Jul 26, 2018, 08:24 PM
1# Method that pulls settings from the standard settings.py
2# file so that you can append or override items.
3def get_setting(setting):
4 try:
5 from . import settings # Python 3
6 except ImportError:
7 import settings # Python 2
8 return getattr(settings, setting)
9
10SECRET_KEY='c98daa54a078e65907c27b0795b81247'
11SITE_SETTINGS_KEY='2ece9ebe6c08bf38ee987c9ccb212838'
12
13INSTALLED_APPS = get_setting('INSTALLED_APPS')
14INSTALLED_APPS = ('tendenci_overrides',) + INSTALLED_APPS
15INSTALLED_APPS = ('blog',) + INSTALLED_APPS
16INSTALLED_APPS += (
17 'django.contrib.gis',
18 'tendenci.apps.committees',
19 'tendenci.apps.case_studies',
20 'tendenci.apps.donations',
21 'tendenci.apps.speakers',
22 'tendenci.apps.staff',
23 'tendenci.apps.studygroups',
24 'tendenci.apps.videos',
25 'tendenci.apps.testimonials',
26 'tendenci.apps.social_services',
27 # -- explorer block --
28 'tendenci.apps.explorer_extensions',
29 'explorer',
30 # -- end of explorer block --
31
32 # --helpdesk --
33 #'markdown_deux',
34 #'bootstrapform',
35 #'tendenci.apps.helpdesk',
36 # -- end of helpdesk
37)
38
39USE_I18N = True
40ALLOWED_HOSTS = ["*"]
41
42SITE_MODE = 'prod'
43
44ADMINS = ()
45MANAGERS = ADMINS
46
47DATABASES = {
48 'default': {
49 'ENGINE': 'django.contrib.gis.db.backends.postgis',
50 'NAME': 'website7',
51 'HOST': 'localhost',
52 'USER': 'website7',
53 'PASSWORD': 'website7',
54 'PORT': 5432,
55 'AUTOCOMMIT': True,
56 }
57}
58
59
60SSL_ENABLED = False
61CELERY_IS_ACTIVE = False
62
63# Logged in users may either be logged out when the user closes their
64# browser, or may remain logged in after the user closes and reopens
65# their browser.
66# For logins through /admin/login/, SESSION_EXPIRE_AT_BROWSER_CLOSE
67# controls this behavior.
68# For logins through /accounts/login/, the "Hide Remember Me" and
69# "Remember Me Checked" settings in the "Users" app in Tendenci control
70# this behavior, overriding SESSION_EXPIRE_AT_BROWSER_CLOSE.
71SESSION_EXPIRE_AT_BROWSER_CLOSE = False
72# Independently of that behavior, users will also be logged out by both
73# the server and their browser if they do not visit the site for more
74# than SESSION_COOKIE_AGE seconds. However, each page load will reset
75# this counter, allowing the user to remain logged in indefinitely as
76# long as they continue to visit the site regularly.
77SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 # 2 weeks
78
79#SESSION_COOKIE_SECURE = True # Send Session Cookie over HTTPS only
80#CSRF_COOKIE_SECURE = True # Send CSRF Cookie over HTTPS only
81
82# Uncomment to properly detect HTTP vs HTTPS when running behind nginx.
83# DO NOT uncomment if not running behind nginx, as that will open a security
84# hole.
85#SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
86
87# Local time zone for this installation. Choices can be found here:
88# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
89# although not all choices may be available on all operating systems.
90# In a Windows environment this must be set to your system time zone.
91TIME_ZONE = 'US/Central'
92
93# -------------------------------------- #
94# DEBUG OPTIONS
95# -------------------------------------- #
96SENTRY_DSN = ""
97if SENTRY_DSN:
98 INSTALLED_APPS += ('raven.contrib.django.raven_compat',)
99 RAVEN_CONFIG = {
100 'dsn': SENTRY_DSN,
101}
102
103# ---------------------------------------#
104# PAYMENT GATEWAY
105# ---------------------------------------#
106# authorizenet, firstdata (the first two)
107MERCHANT_LOGIN = ''
108MERCHANT_TXN_KEY = ''
109AUTHNET_MD5_HASH_VALUE = False
110
111# paypalpayflowlink (currently US only unfortunately per PayPal)
112PAYPAL_MERCHANT_LOGIN = ''
113PAYFLOWLINK_PARTNER = 'PayPal'
114# Uncomment when using the PayPal Sandbox
115#PAYPAL_POST_URL = 'https://www.sandbox.paypal.com/cgi-bin/webscr'
116
117# stripe
118STRIPE_SECRET_KEY = ''
119STRIPE_PUBLISHABLE_KEY = ''
120
121# -------------------------------------- #
122# EMAIL
123# -------------------------------------- #
124# remove or comment out this line once you have your email backend set up.
125EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
126
127# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
128# EMAIL_USE_TLS = False
129# EMAIL_HOST = None
130# EMAIL_PORT = 25
131# EMAIL_HOST_USER = None
132# EMAIL_HOST_PASSWORD = None
133
134#EMAIL_BACKEND = "django_ses.SESBackend"
135# AWS_ACCESS_KEY_ID = ''
136# AWS_SECRET_ACCESS_KEY = ''
137
138DEFAULT_FROM_EMAIL = "no-reply@example.com"
139SERVER_EMAIL = DEFAULT_FROM_EMAIL
140
141# -------------------------------------- #
142# CACHE
143# -------------------------------------- #
144
145SITE_CACHE_KEY = SECRET_KEY
146CACHE_PRE_KEY = SITE_CACHE_KEY
147
148
149CACHES = {
150 'default': {
151 'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
152 }
153}
154
155# Local memcached requires memcached to be running locally.
156MEMCACHED_ENABLED = True
157if MEMCACHED_ENABLED:
158 CACHES = {
159 'default': {
160 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
161 'LOCATION': "127.0.0.1:11211",
162 }
163 }
164CACHES['default']['TIMEOUT'] = 60 * 60 * 24 * 30 # 30 days
165
166
167# sql explorer only allows superuser
168EXPLORER_PERMISSION_VIEW = lambda u: u.is_superuser
169EXPLORER_PERMISSION_CHANGE = lambda u: u.is_superuser
170
171# helpdesk
172#HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT = True
173
174# debug mode
175DEBUG = False
176
177# Django Debug Toolbar for profiling (measuring CPU/SQL/cache/etc timing)
178# Set DEBUG_TOOLBAR_INSTALLED to deploy the relevant static files (when
179# `python manage.py deploy` is run) and add the necessary middleware.
180# Set DEBUG_TOOLBAR_ENABLED to actually enable profiling and the toolbar.
181# DEBUG_TOOLBAR_INSTALLED should not impact performance, but
182# DEBUG_TOOLBAR_ENABLED will slow down Django.
183DEBUG_TOOLBAR_INSTALLED = True
184DEBUG_TOOLBAR_ENABLED = False
185DEBUG_TOOLBAR_CONFIG = {
186 'SHOW_TOOLBAR_CALLBACK': lambda req: DEBUG_TOOLBAR_ENABLED,
187 'SHOW_COLLAPSED': False,
188}
189
190TEMPLATES = get_setting('TEMPLATES')
191TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
192# Turn off the template caching
193# TEMPLATES[0]['OPTIONS']['loaders'] = [
194# 'app_namespace.Loader',
195# 'tendenci.apps.theme.template_loaders.Loader',
196# 'django.template.loaders.filesystem.Loader',
197# 'django.template.loaders.app_directories.Loader',
198# ]
199
200# -------------------------------------- #
201# LOGGING
202# -------------------------------------- #
203ENABLE_LOGGING = False
204if ENABLE_LOGGING:
205 if DEBUG:
206 import sys
207 if not sys.warnoptions:
208 # Log Python Warnings to the py.warnings logger instead of the console
209 import logging
210 logging.captureWarnings(True)
211 # Enable ImportWarning and DeprecationWarning messages
212 import warnings
213 warnings.simplefilter("default")
214 LOGGING = {
215 'version': 1,
216 'disable_existing_loggers': False,
217 'root': {
218 # Set the default logger level to DEBUG so that all messages are passed
219 # to the handlers and the handlers can decide which messages to actually
220 # log.
221 'level': 'DEBUG',
222 'handlers': ['file', 'debug_file', 'mail_admins'],
223 },
224 'loggers': {
225 # The 'django' logger must be defined to override the defaults
226 # configured by Django:
227 # https://github.com/django/django/blob/master/django/utils/log.py
228 'django': {
229 'level': 'DEBUG',
230 # Disable the default handlers
231 'handlers': [],
232 # And use the 'root' handlers above instead
233 'propagate': True,
234 },
235 # In Django <=1.10, 'django.request', 'django.security', and
236 # 'py.warnings' must also be defined to override the defaults configured
237 # by Django.
238 'django.request': {
239 'level': 'DEBUG',
240 'handlers': [],
241 'propagate': True,
242 },
243 'django.security': {
244 'level': 'DEBUG',
245 'handlers': [],
246 'propagate': True,
247 },
248 'py.warnings': {
249 'level': 'DEBUG',
250 'handlers': [],
251 'propagate': True,
252 },
253 # django.db.backends logs all SQL statements at DEBUG level when
254 # settings.DEBUG is True. That produces lots of log messages, so set
255 # the level at INFO to filter them.
256 'django.db.backends': {
257 'level': 'INFO',
258 },
259 # The Daphne web server logs connection details at DEBUG level. That
260 # produces lots of log messages, so set the level at INFO to filter
261 # them when running under Daphne.
262 # In addition, Daphne logs ERRORs when workers are stopped/started. It
263 # is probably unnecessary to send emails for those, so disable the
264 # mail_admins handler for Daphne logs.
265 'daphne': {
266 'level': 'INFO',
267 'handlers': ['file', 'debug_file'],
268 'propagate': False,
269 },
270 },
271 'filters': {
272 'require_debug_true': {
273 '()': 'django.utils.log.RequireDebugTrue',
274 },
275 'require_debug_false': {
276 '()': 'django.utils.log.RequireDebugFalse',
277 },
278 },
279 'formatters': {
280 'info': {
281 'format': 'TIME="%(asctime)s" LEVEL=%(levelname)s PID=%(process)d LOGGER="%(name)s" MSG="%(message)s"'
282 },
283 'debug': {
284 'format': 'TIME="%(asctime)s" LEVEL=%(levelname)s PID=%(process)d LOGGER="%(name)s" FILE="%(pathname)s" LINE=%(lineno)s FUNC="%(funcName)s" MSG="%(message)s"'
285 },
286 },
287 'handlers': {
288 # FileHandler is thread safe but not multi-process safe, so log output could be interleaved
289 # if multiple worker processes generate a log message at the same time. Since Django and
290 # Tendenci logging is minimal and mostly non-critical, this is not likely to be much of a
291 # problem in most cases. However, if you need multi-process safe logging, use SysLogHandler
292 # or SocketHandler with a log server such as https://pypi.python.org/pypi/multilog .
293 #
294 # DO NOT use RotatingFileHandler or TimedRotatingFileHandler here, as their rotation
295 # behavior is not multi-process safe and will cause data to be lost from rotated log files.
296 # When using those Handlers, each process will redundantly rotate the files and will
297 # overwrite any files previously rotated by another process. If you need logs to be
298 # automatically rotated, either use logrotate (and restart Tendenci after rotation), or use
299 # SocketHandler with a log server such as multilog which can then safely use
300 # RotatingFileHandler or TimedRotatingFileHandler.
301 'file': {
302 'level': 'INFO',
303 'formatter': 'info',
304 'class': 'logging.FileHandler',
305 'filename': '/var/log/tendenci/app.log',
306 },
307 'debug_file': {
308 'filters': ['require_debug_true'],
309 'level': 'DEBUG',
310 'formatter': 'debug',
311 'class': 'logging.FileHandler',
312 'filename': '/var/log/tendenci/debug.log',
313 },
314 'mail_admins': {
315 'level': 'ERROR',
316 'class': 'tendenci.apps.base.log.CustomAdminEmailHandler',
317 },
318 'discard': {
319 'level': 'CRITICAL',
320 'class': 'logging.NullHandler',
321 },
322 },
323 }