def test_uses_local_memory_backend_if_no_memcache_addon_is_available(self): self.assertEqual( memcacheify(), { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache' } })
def tests_uses_local_memory_backend_if_one_of_the_memcache_env_vars_is_missing(self): environ['MEMCACHE_PASSWORD'] = '******' environ['MEMCACHE_SERVERS'] = 'mc3.ec2.northscale.net' self.assertEqual(memcacheify(), {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'} }) del environ['MEMCACHE_PASSWORD'] del environ['MEMCACHE_SERVERS']
def test_uses_local_memory_backend_if_no_memcachier_addon_is_available(self): environ['MEMCACHIER_PASSWORD'] = '******' environ['MEMCACHIER_SERVERS'] = 'mc1.ec2.memcachier.com' self.assertEqual(memcacheify(), {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'} }) del environ['MEMCACHIER_PASSWORD'] del environ['MEMCACHIER_SERVERS']
def test_sets_proper_backend_when_memcache_addon_is_available(self): environ["MEMCACHE_PASSWORD"] = "******" environ["MEMCACHE_SERVERS"] = "mc3.ec2.northscale.net" environ["MEMCACHE_USERNAME"] = "******" self.assertEqual(memcacheify()["default"]["BACKEND"], "django_pylibmc.memcached.PyLibMCCache") del environ["MEMCACHE_PASSWORD"] del environ["MEMCACHE_SERVERS"] del environ["MEMCACHE_USERNAME"]
def test_sets_proper_backend_when_memcache_addon_is_available(self): environ['MEMCACHE_PASSWORD'] = '******' environ['MEMCACHE_SERVERS'] = 'mc3.ec2.northscale.net' environ['MEMCACHE_USERNAME'] = '******' self.assertEqual(memcacheify()['default']['BACKEND'], 'django_pylibmc.memcached.PyLibMCCache') del environ['MEMCACHE_PASSWORD'] del environ['MEMCACHE_SERVERS'] del environ['MEMCACHE_USERNAME']
class Production(Base): SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') SECURE_SSL_REDIRECT = True SECRET_KEY = values.SecretValue() CACHES = memcacheify() EMAIL_HOST = 'smtp.mailgun.org' EMAIL_HOST_USER = values.SecretValue() EMAIL_PORT = int(587) EMAIL_HOST_PASSWORD = values.SecretValue() EMAIL_SUBJECT_PREFIX = 'Eguide:' DEFAULT_FROM_EMAIL = '*****@*****.**' SERVER_EMAIL = '*****@*****.**' MAILGUN_API_KEY = values.SecretValue() MAILGUN_DOMAIN = 'mg.electionguide.org' MAILGUN_MAILINGLIST = '*****@*****.**' # STORAGE CONFIGURATION # See: http://django-storages.readthedocs.org/en/latest/index.html INSTALLED_APPS = Base.INSTALLED_APPS + ( 'storages', ) RECAPTCHA_PUBLIC_KEY = values.SecretValue() RECAPTCHA_PRIVATE_KEY = values.SecretValue() # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings AWS_ACCESS_KEY_ID = values.SecretValue() AWS_SECRET_ACCESS_KEY = values.SecretValue() AWS_STORAGE_BUCKET_NAME = values.SecretValue() AWS_AUTO_CREATE_BUCKET = False AWS_QUERYSTRING_AUTH = values.BooleanValue(False) # see: https://github.com/antonagestam/collectfast AWS_PRELOAD_METADATA = True # AWS cache settings, don't change unless you know what you're doing: AWS_EXPIRY = 60 * 60 * 24 * 7 AWS_HEADERS = { 'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % ( AWS_EXPIRY, AWS_EXPIRY) } # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url try: STATIC_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME.setup('AWS_STORAGE_BUCKET_NAME') except ValueError: pass
def get_cache_config(): """Return a fully configured Django ``CACHES`` setting. Scans environment variables for available memcache addon. Additionally includes Django's LocMemCache backend under ``"locmem"`` cache name. """ caches = memcacheify() caches["locmem"] = { "BACKEND": "django.core.cache.backends.locmem.LocMemCache" } return caches
def test_uses_local_memory_backend_if_no_memcachier_addon_is_available( self): environ['MEMCACHIER_PASSWORD'] = '******' environ['MEMCACHIER_SERVERS'] = 'mc1.ec2.memcachier.com' self.assertEqual( memcacheify(), { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache' } }) del environ['MEMCACHIER_PASSWORD'] del environ['MEMCACHIER_SERVERS']
def tests_uses_local_memory_backend_if_one_of_the_memcache_env_vars_is_missing( self): environ['MEMCACHE_PASSWORD'] = '******' environ['MEMCACHE_SERVERS'] = 'mc3.ec2.northscale.net' self.assertEqual( memcacheify(), { 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache' } }) del environ['MEMCACHE_PASSWORD'] del environ['MEMCACHE_SERVERS']
def test_sets_proper_backend_when_memcachier_addon_is_available(self): environ['MEMCACHIER_PASSWORD'] = '******' environ['MEMCACHIER_SERVERS'] = 'mc1.ec2.memcachier.com' environ['MEMCACHIER_USERNAME'] = '******' caches = memcacheify() self.assertEqual(caches['default']['BACKEND'], 'django_pylibmc.memcached.PyLibMCCache') self.assertEqual(environ['MEMCACHE_SERVERS'], environ['MEMCACHIER_SERVERS']) self.assertEqual(environ['MEMCACHE_USERNAME'], environ['MEMCACHIER_USERNAME']) self.assertEqual(environ['MEMCACHE_PASSWORD'], environ['MEMCACHIER_PASSWORD']) del environ['MEMCACHIER_PASSWORD'] del environ['MEMCACHIER_SERVERS'] del environ['MEMCACHIER_USERNAME'] del environ['MEMCACHE_PASSWORD'] del environ['MEMCACHE_SERVERS'] del environ['MEMCACHE_USERNAME']
def test_sets_proper_backend_when_memcachier_addon_is_available(self): environ["MEMCACHIER_PASSWORD"] = "******" environ["MEMCACHIER_SERVERS"] = "mc1.ec2.memcachier.com" environ["MEMCACHIER_USERNAME"] = "******" caches = memcacheify() self.assertEqual(caches["default"]["BACKEND"], "django_pylibmc.memcached.PyLibMCCache") self.assertEqual(environ["MEMCACHE_SERVERS"], environ["MEMCACHIER_SERVERS"]) self.assertEqual(environ["MEMCACHE_USERNAME"], environ["MEMCACHIER_USERNAME"]) self.assertEqual(environ["MEMCACHE_PASSWORD"], environ["MEMCACHIER_PASSWORD"]) del environ["MEMCACHIER_PASSWORD"] del environ["MEMCACHIER_SERVERS"] del environ["MEMCACHIER_USERNAME"] del environ["MEMCACHE_PASSWORD"] del environ["MEMCACHE_SERVERS"] del environ["MEMCACHE_USERNAME"]
def test_sets_proper_backend_when_memcachedcloud_addon_is_available(self): environ['MEMCACHEDCLOUD_PASSWORD'] = '******' environ['MEMCACHEDCLOUD_SERVERS'] = 'zzzz' environ['MEMCACHEDCLOUD_USERNAME'] = '******' caches = memcacheify() self.assertEqual(caches['default']['BACKEND'], 'django_pylibmc.memcached.PyLibMCCache') self.assertEqual(environ['MEMCACHE_SERVERS'], environ['MEMCACHEDCLOUD_SERVERS']) self.assertEqual(environ['MEMCACHE_USERNAME'], environ['MEMCACHEDCLOUD_USERNAME']) self.assertEqual(environ['MEMCACHE_PASSWORD'], environ['MEMCACHEDCLOUD_PASSWORD']) del environ['MEMCACHEDCLOUD_PASSWORD'] del environ['MEMCACHEDCLOUD_SERVERS'] del environ['MEMCACHEDCLOUD_USERNAME'] del environ['MEMCACHE_PASSWORD'] del environ['MEMCACHE_SERVERS'] del environ['MEMCACHE_USERNAME']
def CACHES(self): """ Return a fully configured Django ``CACHES`` setting. Scans environment variables for available memcache add-on. Additionally includes Django's LocMemCache backend under ``"locmem"`` cache name. """ from memcacheify import memcacheify caches = memcacheify() caches.update({ "locmem": { "BACKEND": "django.core.cache.backends.locmem.LocMemCache" }, "dummy": { "BACKEND": "django.core.cache.backends.dummy.DummyCache", } }) return caches
def tests_uses_local_memory_backend_if_one_of_the_memcache_env_vars_is_missing(self): environ["MEMCACHE_PASSWORD"] = "******" environ["MEMCACHE_SERVERS"] = "mc3.ec2.northscale.net" self.assertEqual(memcacheify(), {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}}) del environ["MEMCACHE_PASSWORD"] del environ["MEMCACHE_SERVERS"]
def test_uses_local_memory_backend_if_no_memcache_addon_is_available(self): self.assertEqual(memcacheify(), {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}})
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-use-tls EMAIL_USE_TLS = True # See: https://docs.djangoproject.com/en/dev/ref/settings/#server-email SERVER_EMAIL = EMAIL_HOST_USER ## Database configuration # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases DATABASES = postgresify() ## Cache configuration # See: https://docs.djangoproject.com/en/dev/ref/settings/#caches if CACHES is None: CACHES = dict() CACHES.update(memcacheify()) ## Secret key configuration # See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key # Use the value set in the Heroku configuration. SECRET_KEY = os.environ.get('SECRET_KEY', SECRET_KEY) ## Gunicorn configuration # See: http://gunicorn.org/run.html # See: https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/gunicorn/ INSTALLED_APPS += ('gunicorn', ) ## django-storages and AWS configuration # See: http://django-storages.readthedocs.org/en/latest/index.html # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings
DATABASES = { 'default': env.db(), } ##### # Cache Settings # Attempt to get the memcache info from Heroku. try: # `django-heroku-memcachify` requires memcache to work. Since we only # need it on heroku and don't want to require libmemcached on dev # machines, we'll only use it if it's installed from memcacheify import memcacheify default_cache = memcacheify()['default'] # memcacheify will use the LocMemCache if there is no heroku cache. So if # we see the 'LocMemCache' we know that memcachify is not running on a # heroku dyno that is setup for memcached # pylint: disable=line-too-long if default_cache['BACKEND'] == 'django.core.cache.backends.locmem.LocMemCache': default_cache = env.cache() except ImportError: # If `django-heroku-memcachify` is not installed, just use the cache # defined in the environment default_cache = env.cache() CACHES = {
EMAIL_USE_TLS = True # See: https://docs.djangoproject.com/en/dev/ref/settings/#server-email SERVER_EMAIL = EMAIL_HOST_USER ## Database configuration # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases DATABASES = postgresify() ## Cache configuration # See: https://docs.djangoproject.com/en/dev/ref/settings/#caches if CACHES is None: CACHES = dict() CACHES.update(memcacheify()) ## Secret key configuration # See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key # Use the value set in the Heroku configuration. SECRET_KEY = os.environ.get('SECRET_KEY', SECRET_KEY) ## Gunicorn configuration # See: http://gunicorn.org/run.html # See: https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/gunicorn/ INSTALLED_APPS += ( 'gunicorn', )
class Production(Common): # This ensures that Django will be able to detect a secure connection # properly on Heroku. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') # INSTALLED_APPS INSTALLED_APPS = Common.INSTALLED_APPS # END INSTALLED_APPS # SECRET KEY SECRET_KEY = values.SecretValue() # END SECRET KEY # django-secure INSTALLED_APPS += ("djangosecure", ) # set this to 60 seconds and then to 518400 when you can prove it works SECURE_HSTS_SECONDS = 60 SECURE_HSTS_INCLUDE_SUBDOMAINS = values.BooleanValue(True) SECURE_FRAME_DENY = values.BooleanValue(True) SECURE_CONTENT_TYPE_NOSNIFF = values.BooleanValue(True) SECURE_BROWSER_XSS_FILTER = values.BooleanValue(True) SESSION_COOKIE_SECURE = values.BooleanValue(False) SESSION_COOKIE_HTTPONLY = values.BooleanValue(True) SECURE_SSL_REDIRECT = values.BooleanValue(True) # end django-secure # SITE CONFIGURATION # Hosts/domain names that are valid for this site # See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts ALLOWED_HOSTS = ["*"] # END SITE CONFIGURATION INSTALLED_APPS += ("gunicorn", ) # STORAGE CONFIGURATION # See: http://django-storages.readthedocs.org/en/latest/index.html INSTALLED_APPS += ( 'storages', ) # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings AWS_ACCESS_KEY_ID = values.SecretValue() AWS_SECRET_ACCESS_KEY = values.SecretValue() AWS_STORAGE_BUCKET_NAME = values.SecretValue() AWS_AUTO_CREATE_BUCKET = True AWS_QUERYSTRING_AUTH = False # see: https://github.com/antonagestam/collectfast AWS_PRELOAD_METADATA = True INSTALLED_APPS += ('collectfast', ) # AWS cache settings, don't change unless you know what you're doing: AWS_EXPIRY = 60 * 60 * 24 * 7 AWS_HEADERS = { 'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % ( AWS_EXPIRY, AWS_EXPIRY) } # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url STATIC_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME # END STORAGE CONFIGURATION # EMAIL DEFAULT_FROM_EMAIL = values.Value('VolunteerApp <*****@*****.**>') EMAIL_HOST = values.Value('smtp.sendgrid.com') EMAIL_HOST_PASSWORD = values.SecretValue(environ_prefix="", environ_name="SENDGRID_PASSWORD") EMAIL_HOST_USER = values.SecretValue(environ_prefix="", environ_name="SENDGRID_USERNAME") EMAIL_PORT = values.IntegerValue(587, environ_prefix="", environ_name="EMAIL_PORT") EMAIL_SUBJECT_PREFIX = values.Value('[VolunteerApp] ', environ_name="EMAIL_SUBJECT_PREFIX") EMAIL_USE_TLS = True SERVER_EMAIL = EMAIL_HOST_USER # END EMAIL # TEMPLATE CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs TEMPLATE_LOADERS = ( ('django.template.loaders.cached.Loader', ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', )), ) # END TEMPLATE CONFIGURATION # CACHING # Only do this here because thanks to django-pylibmc-sasl and pylibmc # memcacheify is painful to install on windows. try: # See: https://github.com/rdegges/django-heroku-memcacheify from memcacheify import memcacheify CACHES = memcacheify() except ImportError: CACHES = values.CacheURLValue(default="memcached://127.0.0.1:11211")
class Production(Common): # INSTALLED_APPS INSTALLED_APPS = Common.INSTALLED_APPS # END INSTALLED_APPS # SECRET KEY SECRET_KEY = values.SecretValue() # END SECRET KEY # django-secure INSTALLED_APPS += ("djangosecure", ) # set this to 60 seconds and then to 518400 when you can prove it works SECURE_HSTS_SECONDS = 60 SECURE_HSTS_INCLUDE_SUBDOMAINS = values.BooleanValue(True) SECURE_FRAME_DENY = values.BooleanValue(True) SECURE_CONTENT_TYPE_NOSNIFF = values.BooleanValue(True) SECURE_BROWSER_XSS_FILTER = values.BooleanValue(True) SESSION_COOKIE_SECURE = values.BooleanValue(False) SESSION_COOKIE_HTTPONLY = values.BooleanValue(True) SECURE_SSL_REDIRECT = values.BooleanValue(True) # end django-secure # SITE CONFIGURATION # Hosts/domain names that are valid for this site # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts ALLOWED_HOSTS = ["*"] # END SITE CONFIGURATION INSTALLED_APPS += ("gunicorn", ) # STORAGE CONFIGURATION # See: http://django-storages.readthedocs.org/en/latest/index.html INSTALLED_APPS += ('storages', ) # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings try: from S3 import CallingFormat AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN except ImportError: pass STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' AWS_ACCESS_KEY_ID = values.SecretValue() AWS_SECRET_ACCESS_KEY = values.SecretValue() AWS_STORAGE_BUCKET_NAME = values.SecretValue() AWS_AUTO_CREATE_BUCKET = True AWS_QUERYSTRING_AUTH = False # see: https://github.com/antonagestam/collectfast AWS_PRELOAD_METADATA = True INSTALLED_APPS += ("collectfast", ) # AWS cache settings, don't change unless you know what you're doing: AWS_EXPIREY = 60 * 60 * 24 * 7 AWS_HEADERS = { 'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % ( AWS_EXPIREY, AWS_EXPIREY) } # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url STATIC_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME # END STORAGE CONFIGURATION # Email DEFAULT_FROM_EMAIL = values.Value('Vault <*****@*****.**>') EMAIL_HOST = values.Value('smtp.sendgrid.com') EMAIL_HOST_PASSWORD = values.SecretValue(environ_prefix="", environ_name="SENDGRID_PASSWORD") EMAIL_HOST_USER = values.SecretValue(environ_prefix="", environ_name="SENDGRID_USERNAME") EMAIL_PORT = values.IntegerValue(587, environ_prefix="", environ_name="EMAIL_PORT") EMAIL_SUBJECT_PREFIX = values.Value('[] ', environ_name="EMAIL_SUBJECT_PREFIX") EMAIL_USE_TLS = True SERVER_EMAIL = DEFAULT_FROM_EMAIL # END EMAIL try: # see: https://github.com/rdegges/django-heroku-memcacheify#install # Avoids installing of pylibmc on development enviroment from memcacheify import memcacheify CACHES = memcacheify() except ImportError: CACHES = values.CacheURLValue(default="memcached://127.0.0.1:11211") # TEMPLATE CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs TEMPLATE_LOADERS = ( ('django.template.loaders.cached.Loader', ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', )), ) # END TEMPLATE CONFIGURATION # Your production stuff: Below this line define 3rd party libary settings
def test_uses_local_memory_backend_if_no_memcache_addon_is_available(self): self.assertEqual(memcacheify(), {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'} })
def test_uses_local_memory_backend_if_no_memcachier_addon_is_available(self): environ["MEMCACHIER_PASSWORD"] = "******" environ["MEMCACHIER_SERVERS"] = "mc1.ec2.memcachier.com" self.assertEqual(memcacheify(), {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}}) del environ["MEMCACHIER_PASSWORD"] del environ["MEMCACHIER_SERVERS"]
import os from memcacheify import memcacheify from .common import * # Allowed Hosts ALLOWED_HOSTS = ['.herokuapp.com'] if 'ALLOWED_HOSTS' in os.environ: ALLOWED_HOSTS.extend(os.environ['ALLOWED_HOSTS'].split(',')) # Cache CACHES = memcacheify() # django-compressor COMPRESS_ENABLED = True # Sentry - error logging service if 'SENTRY_DSN' in os.environ: RAVEN_CONFIG = { 'dsn': os.environ['SENTRY_DSN'], 'register_signals': True, } RAVEN_PUBLIC_DSN = 'https://public@{0}'.format( RAVEN_CONFIG['dsn'].split('@')[1])
class Production(Common): # INSTALLED_APPS INSTALLED_APPS = Common.INSTALLED_APPS # END INSTALLED_APPS # SECRET KEY SECRET_KEY = values.SecretValue() # END SECRET KEY # django-secure INSTALLED_APPS += ("djangosecure", ) # set this to 60 seconds and then to 518400 when you can prove it works SECURE_HSTS_SECONDS = 60 SECURE_HSTS_INCLUDE_SUBDOMAINS = values.BooleanValue(True) SECURE_FRAME_DENY = values.BooleanValue(True) SECURE_CONTENT_TYPE_NOSNIFF = values.BooleanValue(True) SECURE_BROWSER_XSS_FILTER = values.BooleanValue(True) SESSION_COOKIE_SECURE = values.BooleanValue(False) SESSION_COOKIE_HTTPONLY = values.BooleanValue(True) SECURE_SSL_REDIRECT = values.BooleanValue(True) # end django-secure # SITE CONFIGURATION # Hosts/domain names that are valid for this site # See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts ALLOWED_HOSTS = [ "client.pawz.co.uk", "provider.pawz.co.uk", "api.pawz.co.uk", "admin.pawz.co.uk", ] # END SITE CONFIGURATION SUBDOMAIN_URLCONFS = { None: 'project.urls', # no subdomain, e.g. ``example.com`` 'client': 'client.urls', 'provider': 'provider.urls', 'api': 'api.urls', 'admin': 'admin.urls', } # INSTALLED_APPS += ("", ) # STORAGE CONFIGURATION # See: http://django-storages.readthedocs.org/en/latest/index.html INSTALLED_APPS += ( # 'storages', ) # EMAIL DEFAULT_FROM_EMAIL = values.Value('Pawz API <*****@*****.**>') EMAIL_HOST = values.Value('smtp.sendgrid.com') EMAIL_HOST_PASSWORD = values.SecretValue(environ_prefix="", environ_name="SENDGRID_PASSWORD") EMAIL_HOST_USER = values.SecretValue(environ_prefix="", environ_name="SENDGRID_USERNAME") EMAIL_PORT = values.IntegerValue(587, environ_prefix="", environ_name="EMAIL_PORT") EMAIL_SUBJECT_PREFIX = values.Value('[Pawz API] ', environ_name="EMAIL_SUBJECT_PREFIX") EMAIL_USE_TLS = True SERVER_EMAIL = EMAIL_HOST_USER # END EMAIL # TEMPLATE CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs TEMPLATE_LOADERS = ( ('django.template.loaders.cached.Loader', ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', )), ) # END TEMPLATE CONFIGURATION # CACHING # Only do this here because thanks to django-pylibmc-sasl and pylibmc # memcacheify is painful to install on windows. try: # See: https://github.com/rdegges/django-heroku-memcacheify from memcacheify import memcacheify CACHES = memcacheify() except ImportError: CACHES = values.CacheURLValue(default="memcached://127.0.0.1:11211")
class Development(Base): DEBUG = values.BooleanValue(True) TEMPLATE_DEBUG = DEBUG INSTALLED_APPS = Base.INSTALLED_APPS INSTALLED_APPS += ('debug_toolbar', ) # Email Configs EMAIL_HOST = 'smtp.mailgun.org' EMAIL_HOST_USER = '******' EMAIL_PORT = int(587) EMAIL_HOST_PASSWORD = '******' EMAIL_SUBJECT_PREFIX = 'Eguide:' DEFAULT_FROM_EMAIL = '*****@*****.**' SERVER_EMAIL = '*****@*****.**' MAILGUN_API_KEY = 'test' MAILGUN_DOMAIN = 'mg.electionguide.org' MAILGUN_MAILINGLIST = '*****@*****.**' THUMBNAIL_DEBUG = True MIDDLEWARE_CLASSES = Base.MIDDLEWARE_CLASSES + ( 'debug_toolbar.middleware.DebugToolbarMiddleware', ) INTERNAL_IPS = ('127.0.0.1', ) DEBUG_TOOLBAR_PANELS = [ 'debug_toolbar.panels.versions.VersionsPanel', 'debug_toolbar.panels.timer.TimerPanel', 'debug_toolbar.panels.settings.SettingsPanel', 'debug_toolbar.panels.headers.HeadersPanel', 'debug_toolbar.panels.request.RequestPanel', 'debug_toolbar.panels.sql.SQLPanel', 'debug_toolbar.panels.staticfiles.StaticFilesPanel', 'debug_toolbar.panels.templates.TemplatesPanel', 'debug_toolbar.panels.cache.CachePanel', 'debug_toolbar.panels.signals.SignalsPanel', 'debug_toolbar.panels.logging.LoggingPanel', 'debug_toolbar.panels.redirects.RedirectsPanel', ] DEBUG_TOOLBAR_CONFIG = {'INTERCEPT_REDIRECTS': False} # STORAGE CONFIGURATION # See: http://django-storages.readthedocs.org/en/latest/index.html INSTALLED_APPS += ('storages', ) # SJM----- the below media commands are needed to force Digest uploads to save locally. # you need to create a direcotry "media" under the root directory #MEDIA_ROOT = 'media/' #MEDIA_URL = 'media/' #SITE_ROOT = os.path.dirname(__file__) #THUMBNAIL_DEBUG = True MEDIA_ROOT = 'media/' MEDIA_URL = 'media/' # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings #STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings AWS_ACCESS_KEY_ID = values.Value('key') AWS_SECRET_ACCESS_KEY = values.Value('value') AWS_STORAGE_BUCKET_NAME = values.Value('eguide') AWS_AUTO_CREATE_BUCKET = False AWS_QUERYSTRING_AUTH = values.BooleanValue(False) # see: https://github.com/antonagestam/collectfast AWS_PRELOAD_METADATA = True # AWS cache settings, don't change unless you know what you're doing: AWS_EXPIRY = 60 * 60 * 24 * 7 AWS_HEADERS = { 'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIRY, AWS_EXPIRY) } # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url try: STATIC_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME.setup( 'AWS_STORAGE_BUCKET_NAME') except ValueError: pass # END STORAGE CONFIGURATION CACHES = memcacheify() DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'ifes2020_e', 'USER': '******', 'PASSWORD': '******', 'HOST': 'localhost', 'PORT': '', } }
# Database Settings DATABASES = { 'default': env.db(), } ##### # Cache Settings # Attempt to get the memcache info from Heroku. try: # `django-heroku-memcachify` requires memcache to work. Since we only # need it on heroku and don't want to require libmemcached on dev # machines, we'll only use it if it's installed from memcacheify import memcacheify default_cache = memcacheify()['default'] # memcacheify will use the LocMemCache if there is no heroku cache. So if # we see the 'LocMemCache' we know that memcachify is not running on a # heroku dyno that is setup for memcached # pylint: disable=line-too-long if default_cache[ 'BACKEND'] == 'django.core.cache.backends.locmem.LocMemCache': default_cache = env.cache() except ImportError: # If `django-heroku-memcachify` is not installed, just use the cache # defined in the environment default_cache = env.cache() CACHES = {
'OPTIONS': { 'MAX_ENTRIES': 1000 } } } KEY_PREFIX = TREEHERDER_MEMCACHED_KEY_PREFIX # Celery broker setup BROKER_URL = env('BROKER_URL') # This code handles the memcachier service on heroku. if env.bool('IS_HEROKU', default=False): from memcacheify import memcacheify CACHES['default'].update( memcacheify().get('default') ) CELERY_IGNORE_RESULT = True API_HOSTNAME = SITE_URL BROWSERID_AUDIENCES = [SITE_URL] SWAGGER_SETTINGS = {"enabled_methods": ['get', ]} REST_FRAMEWORK_EXTENSIONS = { 'DEFAULT_CACHE_RESPONSE_TIMEOUT': 60 * 15 } HAWK_CREDENTIALS_LOOKUP = 'treeherder.webapp.api.auth.hawk_lookup'
KEY_PREFIX = TREEHERDER_MEMCACHED_KEY_PREFIX # Celery broker setup BROKER_URL = env('BROKER_URL') # Force Celery to use TLS when appropriate (ie if not localhost or SCL3), # rather than relying on `BROKER_URL` having `amqps://` or `?ssl=` set. # This is required since CloudAMQP's automatically defined URL uses neither. if server_supports_tls(BROKER_URL): BROKER_USE_SSL = True # This code handles the memcachier service on heroku. if env.bool('IS_HEROKU', default=False): from memcacheify import memcacheify CACHES['default'].update(memcacheify().get('default')) CELERY_IGNORE_RESULT = True BROWSERID_AUDIENCES = [SITE_URL] SWAGGER_SETTINGS = { "enabled_methods": [ 'get', ] } HAWK_CREDENTIALS_LOOKUP = 'treeherder.webapp.api.auth.hawk_lookup' # Configuration for elasticsearch backend ELASTIC_SEARCH = {
class Production(Common): # This ensures that Django will be able to detect a secure connection # properly on Heroku. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') # INSTALLED_APPS INSTALLED_APPS = Common.INSTALLED_APPS # END INSTALLED_APPS # SECRET KEY SECRET_KEY = values.SecretValue() # END SECRET KEY # django-secure INSTALLED_APPS += ("djangosecure", ) # set this to 60 seconds and then to 518400 when you can prove it works SECURE_HSTS_SECONDS = 60 SECURE_HSTS_INCLUDE_SUBDOMAINS = values.BooleanValue(True) SECURE_FRAME_DENY = values.BooleanValue(True) SECURE_CONTENT_TYPE_NOSNIFF = values.BooleanValue(True) SECURE_BROWSER_XSS_FILTER = values.BooleanValue(True) SESSION_COOKIE_SECURE = values.BooleanValue(False) SESSION_COOKIE_HTTPONLY = values.BooleanValue(True) SECURE_SSL_REDIRECT = values.BooleanValue(True) # end django-secure # SITE CONFIGURATION # Hosts/domain names that are valid for this site # See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts ALLOWED_HOSTS = ["*"] # END SITE CONFIGURATION INSTALLED_APPS += ("gunicorn", ) # STORAGE CONFIGURATION # See: http://django-storages.readthedocs.org/en/latest/index.html INSTALLED_APPS += ('storages', ) # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings AWS_ACCESS_KEY_ID = values.SecretValue() AWS_SECRET_ACCESS_KEY = values.SecretValue() AWS_STORAGE_BUCKET_NAME = values.SecretValue() AWS_AUTO_CREATE_BUCKET = True AWS_QUERYSTRING_AUTH = False # see: https://github.com/antonagestam/collectfast AWS_PRELOAD_METADATA = True INSTALLED_APPS += ("collectfast", ) # AWS cache settings, don't change unless you know what you're doing: AWS_EXPIREY = 60 * 60 * 24 * 7 AWS_HEADERS = { 'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIREY, AWS_EXPIREY) } # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings try: from S3 import CallingFormat AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN except ImportError: # TODO: Fix this where even if in Dev this class is called. pass # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url STATIC_URL = 'https://%s.s3.amazonaws.com/' % AWS_STORAGE_BUCKET_NAME # END STORAGE CONFIGURATION # S3 DIRECT # AWS configuration values are found under django-storages configuration # The region of your bucket, more info: # http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region S3DIRECT_REGION = values.SecretValue() INSTALLED_APPS += ('s3direct', ) S3DIRECT_DESTINATIONS = { 'all': ('datapoints/largefiles', ), } # END S3 DIRECT # EMAIL DEFAULT_FROM_EMAIL = values.Value('lackawanna <*****@*****.**>') EMAIL_HOST = values.Value('smtp.sendgrid.com') EMAIL_HOST_PASSWORD = values.SecretValue(environ_prefix="", environ_name="SENDGRID_PASSWORD") EMAIL_HOST_USER = values.SecretValue(environ_prefix="", environ_name="SENDGRID_USERNAME") EMAIL_PORT = values.IntegerValue(587, environ_prefix="", environ_name="EMAIL_PORT") EMAIL_SUBJECT_PREFIX = values.Value('[lackawanna] ', environ_name="EMAIL_SUBJECT_PREFIX") EMAIL_USE_TLS = True SERVER_EMAIL = EMAIL_HOST_USER # END EMAIL # TEMPLATE CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs TEMPLATE_LOADERS = (('django.template.loaders.cached.Loader', ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', )), ) # END TEMPLATE CONFIGURATION # CACHING # Only do this here because thanks to django-pylibmc-sasl and pylibmc # memcacheify is painful to install on windows. try: # See: https://github.com/rdegges/django-heroku-memcacheify from memcacheify import memcacheify CACHES = memcacheify() except ImportError: CACHES = values.CacheURLValue(default="memcached://127.0.0.1:11211") # END CACHING # Your production stuff: Below this line define 3rd party libary settings # Custom Authentication process (Admin has to verify the new user) # Customised Account Adapter ACCOUNT_ADAPTER = 'lackawanna.users.adapter.LackawannaAccountAdapter' # REST FRAMEWORK CONFIGURATION REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.BasicAuthentication', 'rest_framework.authentication.SessionAuthentication', ), 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated', ), 'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend', ), 'DATETIME_FORMAT': 'iso-8601', 'DEFAULT_THROTTLE_CLASSES': ('rest_framework.throttling.AnonRateThrottle', 'rest_framework.throttling.UserRateThrottle'), 'DEFAULT_THROTTLE_RATES': { 'anon': '100/day', 'user': '******' } } # END REST FRAMEWORK CONFIGURATION # HAYSTACK CONFIGURATION HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor' HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine', 'URL': 'https://*****:*****@privet-5817764.us-east-1.bonsai.io/', 'INDEX_NAME': 'haystack' }, }
class Production(Common): ########## INSTALLED_APPS INSTALLED_APPS = Common.INSTALLED_APPS ########## END INSTALLED_APPS ########## SECRET KEY SECRET_KEY = values.SecretValue() ########## END SECRET KEY ########## django-secure INSTALLED_APPS += ("djangosecure", ) # set this to 60 seconds and then to 518400 when you can prove it works SECURE_HSTS_SECONDS = 60 SECURE_HSTS_INCLUDE_SUBDOMAINS = values.BooleanValue(True) SECURE_FRAME_DENY = values.BooleanValue(True) SECURE_CONTENT_TYPE_NOSNIFF = values.BooleanValue(True) SECURE_BROWSER_XSS_FILTER = values.BooleanValue(True) SESSION_COOKIE_SECURE = values.BooleanValue(False) SESSION_COOKIE_HTTPONLY = values.BooleanValue(True) SECURE_SSL_REDIRECT = values.BooleanValue(True) ########## end django-secure ########## SITE CONFIGURATION # Hosts/domain names that are valid for this site # See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts ALLOWED_HOSTS = ["*"] ########## END SITE CONFIGURATION INSTALLED_APPS += ("gunicorn", ) INSTALLED_APPS += ("raven.contrib.django.raven_compat", ) RAVEN_CONFIG = { 'dsn': values.SecretValue(environ_prefix="", environ_name="SENTRY_DSN"), } ########## STORAGE CONFIGURATION # See: http://django-storages.readthedocs.org/en/latest/index.html INSTALLED_APPS += ( 'storages', ) # Set below to 'storages.backends.s3boto.S3BotoStorage' to use S3 # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings DEFAULT_FILE_STORAGE = values.Value(default='django.core.files.storage.FileSystemStorage') STATICFILES_STORAGE = values.Value(default=DEFAULT_FILE_STORAGE) # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings AWS_ACCESS_KEY_ID = values.SecretValue() AWS_SECRET_ACCESS_KEY = values.SecretValue() AWS_STORAGE_BUCKET_NAME = values.SecretValue() AWS_AUTO_CREATE_BUCKET = True AWS_QUERYSTRING_AUTH = False # see: https://github.com/antonagestam/collectfast AWS_PRELOAD_METADATA = True INSTALLED_APPS += ("collectfast", ) # AWS cache settings, don't change unless you know what you're doing: AWS_EXPIREY = 60 * 60 * 24 * 7 AWS_HEADERS = { 'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIREY, AWS_EXPIREY) } # Set below to 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME to # use S3 # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url STATIC_URL = values.Value(default='/static/') ########## END STORAGE CONFIGURATION ########## EMAIL DEFAULT_FROM_EMAIL = values.Value( '{{cookiecutter.project_name}} <noreply@{{cookiecutter.domain_name}}>') EMAIL_HOST = values.Value('smtp.mandrillapp.com') EMAIL_HOST_PASSWORD = values.SecretValue(environ_name="EMAIL_HOST_PASSWORD") EMAIL_HOST_USER = values.SecretValue(environ_name="EMAIL_HOST_USER") EMAIL_PORT = values.IntegerValue(587, environ_name="EMAIL_PORT") EMAIL_SUBJECT_PREFIX = values.Value('[{{cookiecutter.project_name}}] ', environ_name="EMAIL_SUBJECT_PREFIX") EMAIL_USE_TLS = True SERVER_EMAIL = EMAIL_HOST_USER ########## END EMAIL ########## TEMPLATE CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs TEMPLATE_LOADERS = ( ('django.template.loaders.cached.Loader', ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', )), ) ########## END TEMPLATE CONFIGURATION ########## CACHING # Only do this here because thanks to django-pylibmc-sasl and pylibmc memcacheify is painful to install on windows. try: # See: https://github.com/rdegges/django-heroku-memcacheify from memcacheify import memcacheify CACHES = memcacheify() except ImportError: CACHES = values.CacheURLValue(default="memcached://127.0.0.1:11211")
import os import dj_database_url from memcacheify import memcacheify from settings import * # No debug DEBUG = False TEMPLATE_DEBUG = False # Heroku hosted database & cache DATABASES['default'] = dj_database_url.config() CACHES = memcacheify(timeout=60) # cache for max one minute # Sendgrid email EMAIL_HOST_USER = os.environ['SENDGRID_USERNAME'] EMAIL_HOST = 'smtp.sendgrid.net' EMAIL_PORT = 587 EMAIL_USE_TLS = True EMAIL_HOST_PASSWORD = os.environ['SENDGRID_PASSWORD'] # SSL SSLIFY_DISABLE = False SECURE_PROXY_SSL_HEADER = ('HTTP_CF_VISITOR', '{"scheme":"https"}',) # for cloudflare # SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') # for heroku SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True # Allowed host headers ALLOWED_HOSTS = ['stories-of-solidarity.herokuapp.com', 'app.storiesofsolidarity.org'] CORS_ORIGIN_WHITELIST = [
KEY_PREFIX = TREEHERDER_MEMCACHED_KEY_PREFIX # celery broker setup BROKER_URL = 'amqp://{0}:{1}@{2}:{3}/{4}'.format( RABBITMQ_USER, RABBITMQ_PASSWORD, RABBITMQ_HOST, RABBITMQ_PORT, RABBITMQ_VHOST ) # This code handles the memcachier service on heroku. if "IS_HEROKU" in os.environ: from memcacheify import memcacheify CACHES['default'].update( memcacheify().get('default') ) if "CLOUDAMQP_URL" in os.environ: BROKER_URL = os.environ["CLOUDAMQP_URL"] BROKER_POOL_LIMIT = 1 CELERY_IGNORE_RESULT = True API_HOSTNAME = SITE_URL BROWSERID_AUDIENCES = [SITE_URL] SWAGGER_SETTINGS = {"enabled_methods": ['get', ]} REST_FRAMEWORK_EXTENSIONS = {
class Production(Common): # INSTALLED_APPS INSTALLED_APPS = Common.INSTALLED_APPS # END INSTALLED_APPS # DATABASE CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#databases DATABASES = values.DatabaseURLValue( 'postgres://*****:*****@localhost/animate_web') # END DATABASE CONFIGURATION # SECRET KEY SECRET_KEY = 'w)ca-a0xdt1!*m%uf0829_)^&w@(=x&ygzeymy1=1av)z#^*%e' # END SECRET KEY # django-secure INSTALLED_APPS += ( "djangosecure", "s3_folder_storage", # static and media to S3 seperately ) # set this to 60 seconds and then to 518400 when you can prove it works SECURE_HSTS_SECONDS = 60 SECURE_HSTS_INCLUDE_SUBDOMAINS = values.BooleanValue(True) SECURE_FRAME_DENY = values.BooleanValue(True) SECURE_CONTENT_TYPE_NOSNIFF = values.BooleanValue(True) SECURE_BROWSER_XSS_FILTER = values.BooleanValue(True) SESSION_COOKIE_SECURE = values.BooleanValue(False) SESSION_COOKIE_HTTPONLY = values.BooleanValue(True) SECURE_SSL_REDIRECT = values.BooleanValue(True) # end django-secure # SITE CONFIGURATION # Hosts/domain names that are valid for this site # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts ALLOWED_HOSTS = ["*"] # END SITE CONFIGURATION INSTALLED_APPS += ("gunicorn", ) # STORAGE CONFIGURATION # See: http://django-storages.readthedocs.org/en/latest/index.html INSTALLED_APPS += ('storages', ) # See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings try: from S3 import CallingFormat AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN except ImportError: pass STATICFILES_STORAGE = DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' AWS_ACCESS_KEY_ID = values.Value('AKIAIEF4J3Q2TEXCN4PA') AWS_SECRET_ACCESS_KEY = values.Value( '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') AWS_STORAGE_BUCKET_NAME = values.Value('animate_web') AWS_AUTO_CREATE_BUCKET = True AWS_QUERYSTRING_AUTH = False # see: https://github.com/antonagestam/collectfast AWS_PRELOAD_METADATA = True INSTALLED_APPS += ("collectfast", ) # AWS cache settings, don't change unless you know what you're doing: AWS_EXPIREY = 60 * 60 * 24 * 7 AWS_HEADERS = { 'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIREY, AWS_EXPIREY) } # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url STATIC_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME # END STORAGE CONFIGURATION try: # see: https://github.com/rdegges/django-heroku-memcacheify#install # Avoids installing of pylibmc on development enviroment from memcacheify import memcacheify CACHES = memcacheify() except ImportError: CACHES = values.CacheURLValue(default="memcached://127.0.0.1:11211") # TEMPLATE CONFIGURATION # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs TEMPLATE_LOADERS = (('django.template.loaders.cached.Loader', ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', )), )
AWS_AUTO_CREATE_BUCKET = True AWS_HEADERS = { "Cache-Control": "public, max-age=86400", } AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME STATIC_URL = "https://%s/" % AWS_S3_CUSTOM_DOMAIN COMPRESS_URL = STATIC_URL MEDIA_URL = "https://%s/media/" % AWS_S3_CUSTOM_DOMAIN AWS_S3_FILE_OVERWRITE = True AWS_QUERYSTRING_AUTH = False AWS_S3_SECURE_URLS = True AWS_REDUCED_REDUNDANCY = True AWS_IS_GZIPPED = False CACHES = memcacheify() # Compress static files offline COMPRESS_CSS_FILTERS = [ 'compressor.filters.css_default.CssAbsoluteFilter', 'compressor.filters.cssmin.CSSMinFilter', ] COMPRESS_ROOT = STATIC_ROOT COMPRESS_STORAGE = STATICFILES_STORAGE COMPRESS_OFFLINE = True COMPRESS_ENABLED = True LOGGING = { "version": 1, "disable_existing_loggers": False, "handlers": {
"OPTIONS": {"MAX_ENTRIES": 1000}, }, } KEY_PREFIX = TREEHERDER_MEMCACHED_KEY_PREFIX # celery broker setup BROKER_URL = "amqp://{0}:{1}@{2}:{3}/{4}".format( RABBITMQ_USER, RABBITMQ_PASSWORD, RABBITMQ_HOST, RABBITMQ_PORT, RABBITMQ_VHOST ) # This code handles the memcachier service on heroku. if "IS_HEROKU" in os.environ: from memcacheify import memcacheify CACHES["default"].update(memcacheify().get("default")) if "CLOUDAMQP_URL" in os.environ: BROKER_URL = os.environ["CLOUDAMQP_URL"] BROKER_POOL_LIMIT = 1 CELERY_IGNORE_RESULT = True API_HOSTNAME = SITE_URL BROWSERID_AUDIENCES = [SITE_URL] SWAGGER_SETTINGS = {"enabled_methods": ["get"]} REST_FRAMEWORK_EXTENSIONS = {"DEFAULT_CACHE_RESPONSE_TIMEOUT": 60 * 15}