Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Move settings from a module to a file.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmac committed Aug 14, 2015
1 parent 462aaf6 commit 9338a37
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 33 deletions.
21 changes: 16 additions & 5 deletions settings/base.py → settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from os.path import abspath
import sys

import dj_database_url
import django_cache_url
Expand All @@ -9,12 +9,12 @@
VERSION = (0, 1)

# ROOT path of the project. A pathlib.Path object.
ROOT_PATH = Path(__file__).resolve().parents[1]
ROOT_PATH = Path(__file__).parent
ROOT = str(ROOT_PATH)


def path(*args):
return abspath(str(ROOT_PATH.joinpath(*args)))
return str(ROOT_PATH.joinpath(*args))


DEBUG = config('DEBUG', default=False, cast=bool)
Expand Down Expand Up @@ -43,7 +43,15 @@ def path(*args):
CACHES = {
'default': config('CACHE_URL',
default='locmem://',
cast=django_cache_url.parse)
cast=django_cache_url.parse),
'bad_message_ids': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'TIMEOUT': 12 * 60 * 60, # 12 hours
},
'email_block_list': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'TIMEOUT': 60 * 60, # 1 hour
},
}

ALLOWED_HOSTS = config('ALLOWED_HOSTS',
Expand Down Expand Up @@ -139,7 +147,6 @@ def path(*args):
# view rate limiting
RATELIMIT_VIEW = 'news.views.ratelimited'

# Uncomment these to use Celery, use eager for local dev
CELERY_ALWAYS_EAGER = config('CELERY_ALWAYS_EAGER', DEBUG, cast=bool)
BROKER_HOST = config('BROKER_HOST', 'localhost')
BROKER_PORT = config('BROKER_PORT', 5672, cast=int)
Expand Down Expand Up @@ -201,3 +208,7 @@ def path(*args):
# Tells the product_details module where to find our local JSON files.
# This ultimately controls how LANGUAGES are constructed.
PROD_DETAILS_DIR = path('libs/product_details_json')

if sys.argv[0].endswith('py.test') or (len(sys.argv) > 1 and sys.argv[1] == 'test'):
# stuff that's absolutely required for a test run
CELERY_ALWAYS_EAGER = True
28 changes: 0 additions & 28 deletions settings/__init__.py

This file was deleted.

0 comments on commit 9338a37

Please sign in to comment.