Advertisement
Guest User

Untitled

a guest
Jun 26th, 2018
1,005
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 11.55 KB | None | 0 0
  1. # Method that pulls settings from the standard settings.py
  2. # file so that you can append or override items.
  3. def 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.  
  10. SECRET_KEY='9723d4e59a8b3d0c23c2fcb2dfdd8afa'
  11. SITE_SETTINGS_KEY='aee68ecc53421f894837c980ad0a730e'
  12.  
  13. INSTALLED_APPS = get_setting('INSTALLED_APPS')
  14. INSTALLED_APPS = ('tendenci_overrides',) + INSTALLED_APPS
  15. INSTALLED_APPS += (
  16.     'mama_cas',
  17.     'tendenci_helios',
  18.     'django.contrib.gis',
  19.     'tendenci.apps.committees',
  20.     'tendenci.apps.case_studies',
  21.     'tendenci.apps.donations',
  22.     'tendenci.apps.speakers',
  23.     'tendenci.apps.staff',
  24.     'tendenci.apps.studygroups',
  25.     'tendenci.apps.videos',
  26.     'tendenci.apps.testimonials',
  27.     'tendenci.apps.social_services',
  28.     # -- explorer block --
  29.     'tendenci.apps.explorer_extensions',
  30.     'explorer',
  31.     # -- end of explorer block --
  32.     # --helpdesk --
  33.     #'markdown_deux',
  34.     #'bootstrapform',
  35.     #'tendenci.apps.helpdesk',
  36.     # -- end of helpdesk
  37. )
  38.  
  39. USE_I18N = True
  40. ALLOWED_HOSTS = ["*"]
  41.  
  42. SITE_MODE = 'prod'
  43.  
  44. ADMINS = ()
  45. MANAGERS = ADMINS
  46.  
  47. DATABASES = {
  48.     'default': {
  49.         'ENGINE': 'django.contrib.gis.db.backends.postgis',
  50.         'NAME': 'tendenci',
  51.         'HOST': 'localhost',
  52.         'USER': 'tendenci',
  53.         'PASSWORD': 'tendenci',
  54.         'PORT': 5432,
  55.         'AUTOCOMMIT': True,
  56.         }
  57. }
  58.  
  59.  
  60. SSL_ENABLED = False
  61. CELERY_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.
  71. SESSION_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.
  77. SESSION_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.
  91. TIME_ZONE = 'US/Central'
  92.  
  93. # -------------------------------------- #
  94. # DEBUG OPTIONS
  95. # -------------------------------------- #
  96. SENTRY_DSN = ""
  97. if 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)
  107. MERCHANT_LOGIN = ''
  108. MERCHANT_TXN_KEY = ''
  109. AUTHNET_MD5_HASH_VALUE = False
  110.  
  111. # paypalpayflowlink (currently US only unfortunately per PayPal)
  112. PAYPAL_MERCHANT_LOGIN = ''
  113. PAYFLOWLINK_PARTNER = 'PayPal'
  114. # Uncomment when using the PayPal Sandbox
  115. #PAYPAL_POST_URL = 'https://www.sandbox.paypal.com/cgi-bin/webscr'
  116.  
  117. # stripe
  118. STRIPE_SECRET_KEY = ''
  119. STRIPE_PUBLISHABLE_KEY = ''
  120.  
  121. # -------------------------------------- #
  122. # EMAIL
  123. # -------------------------------------- #
  124. # remove or comment out this line once you have your email backend set up.
  125. EMAIL_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.  
  138. DEFAULT_FROM_EMAIL = "no-reply@example.com"
  139. SERVER_EMAIL = DEFAULT_FROM_EMAIL
  140.  
  141. # -------------------------------------- #
  142. # CACHE
  143. # -------------------------------------- #
  144.  
  145. SITE_CACHE_KEY = SECRET_KEY
  146. CACHE_PRE_KEY = SITE_CACHE_KEY
  147.  
  148.  
  149. CACHES = {
  150.     'default': {
  151.         'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
  152.     }
  153. }
  154.  
  155. # Local memcached requires memcached to be running locally.
  156. MEMCACHED_ENABLED = True
  157. if MEMCACHED_ENABLED:
  158.     CACHES = {
  159.         'default': {
  160.             'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
  161.             'LOCATION': "127.0.0.1:11211",
  162.         }
  163.     }
  164. CACHES['default']['TIMEOUT'] = 60 * 60 * 24 * 30  # 30 days
  165.  
  166.  
  167. # sql explorer only allows superuser
  168. EXPLORER_PERMISSION_VIEW =  lambda u: u.is_superuser
  169. EXPLORER_PERMISSION_CHANGE =  lambda u: u.is_superuser
  170.  
  171. # helpdesk
  172. #HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT = True
  173.  
  174. # debug mode
  175. DEBUG = True
  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.
  183. DEBUG_TOOLBAR_INSTALLED = True
  184. DEBUG_TOOLBAR_ENABLED = False
  185. DEBUG_TOOLBAR_CONFIG = {
  186.     'SHOW_TOOLBAR_CALLBACK': lambda req: DEBUG_TOOLBAR_ENABLED,
  187.     'SHOW_COLLAPSED': False,
  188. }
  189.  
  190. TEMPLATES = get_setting('TEMPLATES')
  191. TEMPLATES[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. # -------------------------------------- #
  203. ENABLE_LOGGING = False
  204. if 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.   }
  324. MAMA_CAS_ENABLE_SINGLE_SIGN_OUT = True
  325. MAMA_CAS_SERVICES = [
  326.     {
  327.         'SERVICE': '^http://helios:8000/auth/after/',
  328.         'CALLBACKS': [
  329.             'tendenci_helios.tendenci_user_attributes',
  330.         ],
  331.         'LOGOUT_ALLOW': True,
  332.         'LOGOUT_URL': 'http://helios:8000/auth/logout',
  333.     }
  334. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement