2009-07-05 18:15:58 +00:00
|
|
|
import sys
|
2009-08-09 21:03:10 +00:00
|
|
|
import os
|
2011-11-27 02:41:12 -05:00
|
|
|
|
2009-08-09 21:03:10 +00:00
|
|
|
# ===========================
|
|
|
|
# = Directory Declaractions =
|
|
|
|
# ===========================
|
2009-07-19 16:55:08 +00:00
|
|
|
|
2020-06-29 17:39:55 -04:00
|
|
|
ROOT_DIR = os.path.dirname(__file__)
|
|
|
|
NEWSBLUR_DIR = os.path.join(ROOT_DIR, "../")
|
|
|
|
MEDIA_ROOT = os.path.join(NEWSBLUR_DIR, 'media')
|
|
|
|
STATIC_ROOT = os.path.join(NEWSBLUR_DIR, 'static')
|
|
|
|
UTILS_ROOT = os.path.join(NEWSBLUR_DIR, 'utils')
|
|
|
|
VENDOR_ROOT = os.path.join(NEWSBLUR_DIR, 'vendor')
|
|
|
|
LOG_FILE = os.path.join(NEWSBLUR_DIR, 'logs/newsblur.log')
|
|
|
|
IMAGE_MASK = os.path.join(NEWSBLUR_DIR, 'media/img/mask.png')
|
2009-07-19 16:55:08 +00:00
|
|
|
|
2009-09-08 03:15:49 +00:00
|
|
|
# ==============
|
|
|
|
# = PYTHONPATH =
|
|
|
|
# ==============
|
|
|
|
|
2010-02-02 18:01:02 -05:00
|
|
|
if '/utils' not in ' '.join(sys.path):
|
2011-04-11 21:57:45 -04:00
|
|
|
sys.path.append(UTILS_ROOT)
|
2012-07-16 23:40:17 -07:00
|
|
|
|
2011-04-11 21:57:45 -04:00
|
|
|
if '/vendor' not in ' '.join(sys.path):
|
|
|
|
sys.path.append(VENDOR_ROOT)
|
2012-07-16 23:40:17 -07:00
|
|
|
|
2013-05-15 17:52:35 -07:00
|
|
|
import logging
|
|
|
|
import datetime
|
|
|
|
import redis
|
|
|
|
import raven
|
|
|
|
import django.http
|
|
|
|
import re
|
|
|
|
from mongoengine import connect
|
2016-12-02 12:37:23 -08:00
|
|
|
from boto.s3.connection import S3Connection, OrdinaryCallingFormat
|
2013-05-15 17:52:35 -07:00
|
|
|
from utils import jammit
|
|
|
|
|
|
|
|
# ===================
|
|
|
|
# = Server Settings =
|
|
|
|
# ===================
|
|
|
|
|
|
|
|
ADMINS = (
|
|
|
|
('Samuel Clay', 'samuel@newsblur.com'),
|
|
|
|
)
|
|
|
|
|
|
|
|
SERVER_NAME = 'newsblur'
|
|
|
|
SERVER_EMAIL = 'server@newsblur.com'
|
|
|
|
HELLO_EMAIL = 'hello@newsblur.com'
|
|
|
|
NEWSBLUR_URL = 'http://www.newsblur.com'
|
2019-12-25 18:13:29 -05:00
|
|
|
IMAGES_URL = 'https://imageproxy.newsblur.com'
|
2013-05-15 17:52:35 -07:00
|
|
|
SECRET_KEY = 'YOUR_SECRET_KEY'
|
2019-01-19 15:37:20 -05:00
|
|
|
IMAGES_SECRET_KEY = "YOUR_SECRET_IMAGE_KEY"
|
2020-06-01 17:09:57 -04:00
|
|
|
DNSIMPLE_TOKEN = "YOUR_DNSIMPLE_TOKEN"
|
|
|
|
RECAPTCHA_SECRET_KEY = "YOUR_RECAPTCHA_KEY"
|
|
|
|
YOUTUBE_API_KEY = "YOUR_YOUTUBE_API_KEY"
|
|
|
|
IMAGES_SECRET_KEY = "YOUR_IMAGES_SECRET_KEY"
|
2013-05-15 17:52:35 -07:00
|
|
|
|
2009-08-09 21:03:10 +00:00
|
|
|
# ===================
|
|
|
|
# = Global Settings =
|
|
|
|
# ===================
|
2009-06-16 03:08:55 +00:00
|
|
|
|
2020-06-05 11:00:54 -04:00
|
|
|
DEBUG = True
|
2011-09-01 09:11:29 -07:00
|
|
|
TEST_DEBUG = False
|
2011-05-08 19:25:58 -04:00
|
|
|
SEND_BROKEN_LINK_EMAILS = False
|
2014-05-20 12:21:17 -07:00
|
|
|
DEBUG_QUERIES = False
|
2011-04-11 09:30:39 -04:00
|
|
|
MANAGERS = ADMINS
|
2010-10-16 18:52:52 -04:00
|
|
|
PAYPAL_RECEIVER_EMAIL = 'samuel@ofbrooklyn.com'
|
2011-04-11 09:30:39 -04:00
|
|
|
TIME_ZONE = 'GMT'
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
SITE_ID = 1
|
|
|
|
USE_I18N = False
|
|
|
|
LOGIN_REDIRECT_URL = '/'
|
2014-01-15 17:12:24 -08:00
|
|
|
LOGIN_URL = '/account/login'
|
2013-08-12 12:26:49 -07:00
|
|
|
MEDIA_URL = '/media/'
|
2014-01-15 14:29:35 -08:00
|
|
|
STATIC_URL = '/media/'
|
|
|
|
STATIC_ROOT = '/media/'
|
2009-08-09 21:03:10 +00:00
|
|
|
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
|
|
|
|
# trailing slash.
|
|
|
|
# Examples: "http://foo.com/media/", "/media/".
|
2011-12-18 23:48:44 -08:00
|
|
|
CIPHER_USERNAMES = False
|
2012-02-28 12:17:38 -08:00
|
|
|
DEBUG_ASSETS = DEBUG
|
2012-08-09 20:42:04 -07:00
|
|
|
HOMEPAGE_USERNAME = 'popular'
|
2013-03-20 16:43:20 -07:00
|
|
|
ALLOWED_HOSTS = ['*']
|
2020-06-05 11:00:54 -04:00
|
|
|
AUTO_PREMIUM_NEW_USERS = True
|
2015-03-12 13:18:05 -07:00
|
|
|
AUTO_ENABLE_NEW_USERS = True
|
2020-06-05 11:00:54 -04:00
|
|
|
ENFORCE_SIGNUP_CAPTCHA = False
|
2014-11-09 12:28:48 -08:00
|
|
|
PAYPAL_TEST = False
|
2009-08-09 21:03:10 +00:00
|
|
|
|
2018-11-04 12:00:14 -05:00
|
|
|
# Uncomment below to force all feeds to store this many stories. Default is to cut
|
|
|
|
# off at 25 stories for single subscriber non-premium feeds and 500 for popular feeds.
|
2018-11-04 12:00:47 -05:00
|
|
|
# OVERRIDE_STORY_COUNT_MAX = 1000
|
2018-11-04 12:00:14 -05:00
|
|
|
|
2009-08-09 21:03:10 +00:00
|
|
|
# ===========================
|
|
|
|
# = Django-specific Modules =
|
|
|
|
# ===========================
|
|
|
|
|
2009-06-16 03:08:55 +00:00
|
|
|
|
|
|
|
MIDDLEWARE_CLASSES = (
|
|
|
|
'django.middleware.gzip.GZipMiddleware',
|
2010-06-11 20:55:38 -04:00
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
2020-06-29 17:39:55 -04:00
|
|
|
'django.middleware.common.CommonMiddleware',
|
2014-01-15 15:41:18 -08:00
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
2009-07-19 16:55:08 +00:00
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
2012-07-13 14:56:12 -07:00
|
|
|
'apps.profile.middleware.TimingMiddleware',
|
2010-06-30 13:36:51 -04:00
|
|
|
'apps.profile.middleware.LastSeenMiddleware',
|
2013-06-25 21:48:22 -07:00
|
|
|
'apps.profile.middleware.UserAgentBanMiddleware',
|
2012-06-28 19:47:30 -07:00
|
|
|
'subdomains.middleware.SubdomainMiddleware',
|
2015-03-12 18:01:20 -07:00
|
|
|
'corsheaders.middleware.CorsMiddleware',
|
2012-07-05 18:30:16 -07:00
|
|
|
'apps.profile.middleware.SimpsonsMiddleware',
|
2013-03-18 11:32:24 -07:00
|
|
|
'apps.profile.middleware.ServerHostnameMiddleware',
|
2014-01-15 15:41:18 -08:00
|
|
|
'oauth2_provider.middleware.OAuth2TokenMiddleware',
|
2009-12-18 20:54:14 +00:00
|
|
|
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
|
2014-03-18 19:19:43 -07:00
|
|
|
'apps.profile.middleware.DBProfilerMiddleware',
|
|
|
|
'apps.profile.middleware.SQLLogToConsoleMiddleware',
|
|
|
|
'utils.mongo_raw_log_middleware.MongoDumpMiddleware',
|
|
|
|
'utils.redis_raw_log_middleware.RedisDumpMiddleware',
|
2009-06-16 03:08:55 +00:00
|
|
|
)
|
|
|
|
|
2014-01-15 15:41:18 -08:00
|
|
|
AUTHENTICATION_BACKENDS = (
|
|
|
|
'oauth2_provider.backends.OAuth2Backend',
|
2020-06-26 19:38:16 -04:00
|
|
|
'django.contrib.auth.backends.ModelBackend',
|
2014-01-15 15:41:18 -08:00
|
|
|
)
|
2013-03-20 16:39:27 -07:00
|
|
|
|
2014-01-15 14:29:35 -08:00
|
|
|
CORS_ORIGIN_ALLOW_ALL = True
|
2015-03-12 18:01:20 -07:00
|
|
|
# CORS_ORIGIN_REGEX_WHITELIST = ('^(https?://)?(\w+\.)?newsblur\.com$', )
|
|
|
|
CORS_ALLOW_CREDENTIALS = True
|
2014-01-15 14:29:35 -08:00
|
|
|
|
2014-01-15 17:12:24 -08:00
|
|
|
OAUTH2_PROVIDER = {
|
|
|
|
'SCOPES': {
|
2014-01-27 12:51:43 -08:00
|
|
|
'read': 'View new unread stories, saved stories, and shared stories.',
|
|
|
|
'write': 'Create new saved stories, shared stories, and subscriptions.',
|
2020-02-17 14:36:41 -05:00
|
|
|
'ifttt': 'Pair your NewsBlur account with other services.',
|
2014-01-15 17:12:24 -08:00
|
|
|
},
|
|
|
|
'CLIENT_ID_GENERATOR_CLASS': 'oauth2_provider.generators.ClientIdGenerator',
|
2016-01-22 12:41:34 -08:00
|
|
|
'ACCESS_TOKEN_EXPIRE_SECONDS': 60*60*24*365*10, # 10 years
|
|
|
|
'AUTHORIZATION_CODE_EXPIRE_SECONDS': 60*60, # 1 hour
|
2014-01-15 17:12:24 -08:00
|
|
|
}
|
|
|
|
|
2011-05-08 19:25:58 -04:00
|
|
|
# ===========
|
|
|
|
# = Logging =
|
|
|
|
# ===========
|
|
|
|
|
|
|
|
LOGGING = {
|
|
|
|
'version': 1,
|
|
|
|
'disable_existing_loggers': False,
|
|
|
|
'formatters': {
|
|
|
|
'verbose': {
|
2013-05-08 02:15:55 -07:00
|
|
|
'format': '[%(asctime)-12s] %(message)s',
|
2011-05-08 19:25:58 -04:00
|
|
|
'datefmt': '%b %d %H:%M:%S'
|
|
|
|
},
|
|
|
|
'simple': {
|
|
|
|
'format': '%(message)s'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'handlers': {
|
|
|
|
'null': {
|
|
|
|
'level':'DEBUG',
|
2020-06-11 03:50:44 -04:00
|
|
|
'class':'logging.NullHandler',
|
2011-05-08 19:25:58 -04:00
|
|
|
},
|
|
|
|
'console':{
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'class': 'logging.StreamHandler',
|
|
|
|
'formatter': 'verbose'
|
|
|
|
},
|
2017-06-02 18:16:33 -07:00
|
|
|
'pyes':{
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'class': 'logging.StreamHandler',
|
|
|
|
'formatter': 'verbose'
|
|
|
|
},
|
2017-04-13 17:25:55 -07:00
|
|
|
'vendor.apns':{
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'class': 'logging.StreamHandler',
|
|
|
|
'formatter': 'verbose'
|
|
|
|
},
|
2011-05-08 19:25:58 -04:00
|
|
|
'log_file':{
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'class': 'logging.handlers.RotatingFileHandler',
|
|
|
|
'filename': LOG_FILE,
|
|
|
|
'maxBytes': '16777216', # 16megabytes
|
|
|
|
'formatter': 'verbose'
|
|
|
|
},
|
|
|
|
'mail_admins': {
|
2015-04-15 16:20:08 -07:00
|
|
|
'level': 'CRITICAL',
|
2011-05-08 19:25:58 -04:00
|
|
|
'class': 'django.utils.log.AdminEmailHandler',
|
2013-03-20 15:05:52 -07:00
|
|
|
'filters': ['require_debug_false'],
|
2011-05-08 19:25:58 -04:00
|
|
|
'include_html': True,
|
2015-12-07 13:51:06 -08:00
|
|
|
},
|
2015-12-18 15:34:05 -08:00
|
|
|
# 'sentry': {
|
|
|
|
# 'level': 'ERROR',
|
|
|
|
# 'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler'
|
|
|
|
# },
|
2011-05-08 19:25:58 -04:00
|
|
|
},
|
|
|
|
'loggers': {
|
2020-06-11 05:50:34 -04:00
|
|
|
'django': {
|
|
|
|
'handlers': ['console', 'mail_admins'],
|
2011-05-08 19:25:58 -04:00
|
|
|
'level': 'ERROR',
|
|
|
|
'propagate': True,
|
|
|
|
},
|
|
|
|
'django.db.backends': {
|
|
|
|
'handlers': ['null'],
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'propagate': False,
|
|
|
|
},
|
2015-04-15 16:20:08 -07:00
|
|
|
'django.security.DisallowedHost': {
|
|
|
|
'handlers': ['null'],
|
|
|
|
'propagate': False,
|
|
|
|
},
|
2011-05-08 19:25:58 -04:00
|
|
|
'newsblur': {
|
|
|
|
'handlers': ['console', 'log_file'],
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'propagate': False,
|
|
|
|
},
|
2017-01-25 17:35:48 -08:00
|
|
|
'readability': {
|
|
|
|
'handlers': ['console'],
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'propagate': False,
|
|
|
|
},
|
2017-06-02 18:16:33 -07:00
|
|
|
'pyes': {
|
|
|
|
'handlers': ['console'],
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'propagate': False,
|
|
|
|
},
|
2015-04-15 16:20:08 -07:00
|
|
|
'apps': {
|
2011-05-08 19:25:58 -04:00
|
|
|
'handlers': ['log_file'],
|
|
|
|
'level': 'INFO',
|
|
|
|
'propagate': True,
|
|
|
|
},
|
2015-12-18 15:34:05 -08:00
|
|
|
# 'raven': {
|
|
|
|
# 'level': 'DEBUG',
|
|
|
|
# 'handlers': ['console'],
|
|
|
|
# 'propagate': False,
|
|
|
|
# },
|
|
|
|
# 'sentry.errors': {
|
|
|
|
# 'level': 'DEBUG',
|
|
|
|
# 'handlers': ['console'],
|
|
|
|
# 'propagate': False,
|
|
|
|
# },
|
2013-03-20 15:05:52 -07:00
|
|
|
},
|
|
|
|
'filters': {
|
|
|
|
'require_debug_false': {
|
|
|
|
'()': 'django.utils.log.RequireDebugFalse'
|
|
|
|
}
|
|
|
|
},
|
2011-05-08 19:25:58 -04:00
|
|
|
}
|
|
|
|
|
2015-08-24 14:26:49 -07:00
|
|
|
logging.getLogger("requests").setLevel(logging.WARNING)
|
|
|
|
logging.getLogger("urllib3").setLevel(logging.WARNING)
|
|
|
|
|
2009-08-09 21:03:10 +00:00
|
|
|
# ==========================
|
|
|
|
# = Miscellaneous Settings =
|
|
|
|
# ==========================
|
|
|
|
|
2013-09-15 21:13:42 -07:00
|
|
|
DAYS_OF_UNREAD = 30
|
2013-09-16 16:42:49 -07:00
|
|
|
DAYS_OF_UNREAD_FREE = 14
|
2015-11-02 00:15:22 -08:00
|
|
|
# DoSH can be more, since you can up this value by N, and after N days,
|
2013-09-16 16:42:49 -07:00
|
|
|
# you can then up the DAYS_OF_UNREAD value with no impact.
|
|
|
|
DAYS_OF_STORY_HASHES = 30
|
|
|
|
|
2014-12-03 09:19:12 -08:00
|
|
|
SUBSCRIBER_EXPIRE = 7
|
2011-01-15 18:41:41 -05:00
|
|
|
|
2020-06-29 17:39:55 -04:00
|
|
|
ROOT_URLCONF = 'newsblur.urls'
|
2011-01-15 18:41:41 -05:00
|
|
|
INTERNAL_IPS = ('127.0.0.1',)
|
|
|
|
LOGGING_LOG_SQL = True
|
2012-08-11 13:56:30 -07:00
|
|
|
APPEND_SLASH = False
|
2013-08-12 12:26:49 -07:00
|
|
|
SESSION_ENGINE = 'redis_sessions.session'
|
2011-01-15 18:41:41 -05:00
|
|
|
TEST_RUNNER = "utils.testrunner.TestRunner"
|
|
|
|
SESSION_COOKIE_NAME = 'newsblur_sessionid'
|
2020-06-24 15:57:19 -04:00
|
|
|
SESSION_COOKIE_AGE = 60*60*24*365*10 # 10 years
|
2012-07-01 18:34:34 -07:00
|
|
|
SESSION_COOKIE_DOMAIN = '.newsblur.com'
|
2020-06-24 15:57:19 -04:00
|
|
|
SESSION_COOKIE_HTTPONLY = False
|
2012-10-25 14:18:25 -07:00
|
|
|
SENTRY_DSN = 'https://XXXNEWSBLURXXX@app.getsentry.com/99999999'
|
2020-06-24 15:57:19 -04:00
|
|
|
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
|
2009-06-16 03:08:55 +00:00
|
|
|
|
2015-12-07 16:55:08 -08:00
|
|
|
if DEBUG:
|
2018-02-26 16:48:52 -08:00
|
|
|
# EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
|
|
|
EMAIL_BACKEND = 'vendor.mailgun.MailgunBackend'
|
2015-12-07 16:55:08 -08:00
|
|
|
else:
|
2018-02-26 16:48:52 -08:00
|
|
|
EMAIL_BACKEND = 'vendor.mailgun.MailgunBackend'
|
2013-08-19 12:01:44 -07:00
|
|
|
|
2012-06-27 01:02:09 -07:00
|
|
|
# ==============
|
|
|
|
# = Subdomains =
|
|
|
|
# ==============
|
|
|
|
|
|
|
|
SUBDOMAIN_URLCONFS = {
|
2020-06-29 17:39:55 -04:00
|
|
|
None: 'newsblur.urls',
|
|
|
|
'www': 'newsblur.urls',
|
2012-06-27 01:02:09 -07:00
|
|
|
}
|
2012-06-28 10:14:42 -07:00
|
|
|
REMOVE_WWW_FROM_DOMAIN = True
|
2012-06-27 01:02:09 -07:00
|
|
|
|
2010-08-16 12:52:39 -04:00
|
|
|
# ===========
|
|
|
|
# = Logging =
|
|
|
|
# ===========
|
|
|
|
|
|
|
|
LOG_LEVEL = logging.DEBUG
|
|
|
|
LOG_TO_STREAM = False
|
|
|
|
|
2009-08-09 21:03:10 +00:00
|
|
|
# ===============
|
|
|
|
# = Django Apps =
|
|
|
|
# ===============
|
|
|
|
|
2020-06-11 05:50:34 -04:00
|
|
|
OAUTH2_PROVIDER_APPLICATION_MODEL = 'oauth2_provider.Application'
|
|
|
|
|
2009-06-16 03:08:55 +00:00
|
|
|
INSTALLED_APPS = (
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.sites',
|
|
|
|
'django.contrib.admin',
|
2010-03-02 10:56:25 -05:00
|
|
|
'django_extensions',
|
2020-06-24 16:59:43 -04:00
|
|
|
'paypal.standard.ipn',
|
2009-06-16 03:08:55 +00:00
|
|
|
'apps.rss_feeds',
|
|
|
|
'apps.reader',
|
|
|
|
'apps.analyzer',
|
2010-06-29 20:16:09 -04:00
|
|
|
'apps.feed_import',
|
2009-06-16 03:08:55 +00:00
|
|
|
'apps.profile',
|
2011-02-28 23:27:58 -05:00
|
|
|
'apps.recommendations',
|
2011-04-15 11:34:41 -04:00
|
|
|
'apps.statistics',
|
2016-11-16 17:49:43 -08:00
|
|
|
'apps.notifications',
|
2011-06-05 17:51:57 -04:00
|
|
|
'apps.static',
|
|
|
|
'apps.mobile',
|
2012-03-27 16:26:07 -07:00
|
|
|
'apps.push',
|
2011-12-15 09:10:37 -08:00
|
|
|
'apps.social',
|
2012-03-19 11:15:26 -07:00
|
|
|
'apps.oauth',
|
2012-07-13 14:33:16 -07:00
|
|
|
'apps.search',
|
2012-08-12 16:49:14 -07:00
|
|
|
'apps.categories',
|
2020-06-29 17:39:55 -04:00
|
|
|
'django_celery_beat',
|
2020-06-05 11:00:54 -04:00
|
|
|
'utils', # missing models so no migrations
|
2011-04-11 21:57:45 -04:00
|
|
|
'vendor',
|
|
|
|
'vendor.typogrify',
|
2012-02-27 21:46:34 -08:00
|
|
|
'vendor.zebra',
|
2014-01-15 14:29:35 -08:00
|
|
|
'oauth2_provider',
|
|
|
|
'corsheaders',
|
2009-07-25 02:21:12 +00:00
|
|
|
)
|
2010-02-11 01:28:47 -05:00
|
|
|
|
2012-02-27 21:46:34 -08:00
|
|
|
# ==========
|
|
|
|
# = Stripe =
|
|
|
|
# ==========
|
|
|
|
|
|
|
|
STRIPE_SECRET = "YOUR-SECRET-API-KEY"
|
|
|
|
STRIPE_PUBLISHABLE = "YOUR-PUBLISHABLE-API-KEY"
|
|
|
|
ZEBRA_ENABLE_APP = True
|
2010-04-05 00:47:21 -04:00
|
|
|
|
2010-08-31 18:15:00 -04:00
|
|
|
# ==========
|
|
|
|
# = Celery =
|
|
|
|
# ==========
|
|
|
|
|
2020-06-29 17:39:55 -04:00
|
|
|
CELERY_TASK_ROUTES = {
|
2012-06-28 12:42:49 -07:00
|
|
|
"work-queue": {
|
|
|
|
"queue": "work_queue",
|
|
|
|
"binding_key": "work_queue"
|
|
|
|
},
|
2010-09-28 19:22:52 -04:00
|
|
|
"new-feeds": {
|
2010-09-20 19:31:17 -04:00
|
|
|
"queue": "new_feeds",
|
2010-09-28 19:22:52 -04:00
|
|
|
"binding_key": "new_feeds"
|
2010-09-20 19:22:19 -04:00
|
|
|
},
|
2012-03-28 15:49:21 -07:00
|
|
|
"push-feeds": {
|
|
|
|
"queue": "push_feeds",
|
|
|
|
"binding_key": "push_feeds"
|
|
|
|
},
|
2010-09-28 19:22:52 -04:00
|
|
|
"update-feeds": {
|
2010-09-20 19:31:17 -04:00
|
|
|
"queue": "update_feeds",
|
2010-09-28 19:22:52 -04:00
|
|
|
"binding_key": "update_feeds"
|
2010-09-20 19:22:19 -04:00
|
|
|
},
|
2012-07-16 23:40:17 -07:00
|
|
|
"beat-tasks": {
|
|
|
|
"queue": "beat_tasks",
|
|
|
|
"binding_key": "beat_tasks"
|
|
|
|
},
|
2014-04-22 15:15:42 -07:00
|
|
|
"search-indexer": {
|
|
|
|
"queue": "search_indexer",
|
|
|
|
"binding_key": "search_indexer"
|
|
|
|
},
|
2014-04-22 18:33:08 -07:00
|
|
|
"search-indexer-tasker": {
|
|
|
|
"queue": "search_indexer_tasker",
|
|
|
|
"binding_key": "search_indexer_tasker"
|
|
|
|
},
|
2010-09-20 19:22:19 -04:00
|
|
|
}
|
2020-06-29 17:39:55 -04:00
|
|
|
CELERY_TASK_QUEUES = {
|
2012-06-28 12:42:49 -07:00
|
|
|
"work_queue": {
|
|
|
|
"exchange": "work_queue",
|
|
|
|
"exchange_type": "direct",
|
|
|
|
"binding_key": "work_queue",
|
|
|
|
},
|
2010-09-20 19:22:19 -04:00
|
|
|
"new_feeds": {
|
2010-09-28 19:22:52 -04:00
|
|
|
"exchange": "new_feeds",
|
|
|
|
"exchange_type": "direct",
|
|
|
|
"binding_key": "new_feeds"
|
2010-09-20 19:22:19 -04:00
|
|
|
},
|
2012-03-28 15:49:21 -07:00
|
|
|
"push_feeds": {
|
|
|
|
"exchange": "push_feeds",
|
|
|
|
"exchange_type": "direct",
|
|
|
|
"binding_key": "push_feeds"
|
|
|
|
},
|
2010-09-20 19:22:19 -04:00
|
|
|
"update_feeds": {
|
2010-09-28 19:22:52 -04:00
|
|
|
"exchange": "update_feeds",
|
|
|
|
"exchange_type": "direct",
|
|
|
|
"binding_key": "update_feeds"
|
2010-09-20 19:22:19 -04:00
|
|
|
},
|
2012-07-16 23:40:17 -07:00
|
|
|
"beat_tasks": {
|
|
|
|
"exchange": "beat_tasks",
|
|
|
|
"exchange_type": "direct",
|
|
|
|
"binding_key": "beat_tasks"
|
|
|
|
},
|
2013-03-14 12:55:10 -07:00
|
|
|
"beat_feeds_task": {
|
|
|
|
"exchange": "beat_feeds_task",
|
|
|
|
"exchange_type": "direct",
|
|
|
|
"binding_key": "beat_feeds_task"
|
|
|
|
},
|
2014-04-22 18:33:08 -07:00
|
|
|
"search_indexer": {
|
|
|
|
"exchange": "search_indexer",
|
|
|
|
"exchange_type": "direct",
|
|
|
|
"binding_key": "search_indexer"
|
|
|
|
},
|
|
|
|
"search_indexer_tasker": {
|
|
|
|
"exchange": "search_indexer_tasker",
|
2014-04-22 15:15:42 -07:00
|
|
|
"exchange_type": "direct",
|
2014-04-22 18:33:08 -07:00
|
|
|
"binding_key": "search_indexer_tasker"
|
2014-04-22 15:15:42 -07:00
|
|
|
},
|
2010-09-20 19:22:19 -04:00
|
|
|
}
|
2020-06-29 17:39:55 -04:00
|
|
|
CELERY_TASK_DEFAULT_QUEUE = "work_queue"
|
2012-02-26 22:33:06 -08:00
|
|
|
|
2020-06-29 17:39:55 -04:00
|
|
|
CELERY_WORKER_PREFETCH_MULTIPLIER = 1
|
2013-05-08 02:15:55 -07:00
|
|
|
CELERY_IMPORTS = ("apps.rss_feeds.tasks",
|
|
|
|
"apps.social.tasks",
|
2012-07-20 19:43:28 -07:00
|
|
|
"apps.reader.tasks",
|
2015-12-18 13:34:57 -08:00
|
|
|
"apps.profile.tasks",
|
2012-12-10 13:33:37 -08:00
|
|
|
"apps.feed_import.tasks",
|
2014-04-16 11:57:49 -07:00
|
|
|
"apps.search.tasks",
|
2012-12-10 13:33:37 -08:00
|
|
|
"apps.statistics.tasks",)
|
2020-06-29 17:39:55 -04:00
|
|
|
CELERY_WORKER_CONCURRENCY = 4
|
|
|
|
CELERY_TASK_IGNORE_RESULT = True
|
|
|
|
CELERY_TASK_ACKS_LATE = True # Retry if task fails
|
|
|
|
CELERY_WORKER_MAX_TASKS_PER_CHILD = 10
|
|
|
|
CELERY_TASK_TIME_LIMIT = 12 * 30
|
|
|
|
CELERY_WORKER_DISABLE_RATE_LIMITS = True
|
2012-08-06 17:52:33 -07:00
|
|
|
SECONDS_TO_DELAY_CELERY_EMAILS = 60
|
2010-08-31 18:15:00 -04:00
|
|
|
|
2020-06-29 17:39:55 -04:00
|
|
|
CELERY_BEAT_SCHEDULE = {
|
2012-07-16 23:40:17 -07:00
|
|
|
'task-feeds': {
|
|
|
|
'task': 'task-feeds',
|
|
|
|
'schedule': datetime.timedelta(minutes=1),
|
2013-03-14 12:55:10 -07:00
|
|
|
'options': {'queue': 'beat_feeds_task'},
|
|
|
|
},
|
2015-07-23 16:29:47 -07:00
|
|
|
'task-broken-feeds': {
|
|
|
|
'task': 'task-broken-feeds',
|
|
|
|
'schedule': datetime.timedelta(hours=6),
|
|
|
|
'options': {'queue': 'beat_feeds_task'},
|
|
|
|
},
|
2013-03-14 12:55:10 -07:00
|
|
|
'freshen-homepage': {
|
|
|
|
'task': 'freshen-homepage',
|
|
|
|
'schedule': datetime.timedelta(hours=1),
|
2012-07-16 23:40:17 -07:00
|
|
|
'options': {'queue': 'beat_tasks'},
|
|
|
|
},
|
|
|
|
'collect-stats': {
|
|
|
|
'task': 'collect-stats',
|
|
|
|
'schedule': datetime.timedelta(minutes=1),
|
|
|
|
'options': {'queue': 'beat_tasks'},
|
|
|
|
},
|
|
|
|
'collect-feedback': {
|
|
|
|
'task': 'collect-feedback',
|
|
|
|
'schedule': datetime.timedelta(minutes=1),
|
|
|
|
'options': {'queue': 'beat_tasks'},
|
|
|
|
},
|
2012-07-31 11:41:30 -07:00
|
|
|
'share-popular-stories': {
|
|
|
|
'task': 'share-popular-stories',
|
2013-08-21 18:38:07 -07:00
|
|
|
'schedule': datetime.timedelta(minutes=10),
|
2012-07-31 11:41:30 -07:00
|
|
|
'options': {'queue': 'beat_tasks'},
|
|
|
|
},
|
2012-09-27 13:18:51 -07:00
|
|
|
'clean-analytics': {
|
|
|
|
'task': 'clean-analytics',
|
|
|
|
'schedule': datetime.timedelta(hours=12),
|
2015-11-28 13:32:18 -08:00
|
|
|
'options': {'queue': 'beat_tasks', 'timeout': 720*10},
|
2012-09-27 13:18:51 -07:00
|
|
|
},
|
2019-07-16 12:00:10 -07:00
|
|
|
'reimport-stripe-history': {
|
|
|
|
'task': 'reimport-stripe-history',
|
|
|
|
'schedule': datetime.timedelta(hours=6),
|
|
|
|
'options': {'queue': 'beat_tasks'},
|
|
|
|
},
|
2015-07-15 10:25:38 -07:00
|
|
|
'clean-spam': {
|
|
|
|
'task': 'clean-spam',
|
2019-09-13 11:38:03 -04:00
|
|
|
'schedule': datetime.timedelta(hours=1),
|
2017-12-20 15:58:34 -08:00
|
|
|
'options': {'queue': 'beat_tasks'},
|
|
|
|
},
|
|
|
|
'clean-social-spam': {
|
|
|
|
'task': 'clean-social-spam',
|
|
|
|
'schedule': datetime.timedelta(hours=6),
|
2015-07-15 10:25:38 -07:00
|
|
|
'options': {'queue': 'beat_tasks'},
|
|
|
|
},
|
2012-12-05 14:25:23 -08:00
|
|
|
'premium-expire': {
|
|
|
|
'task': 'premium-expire',
|
|
|
|
'schedule': datetime.timedelta(hours=24),
|
|
|
|
'options': {'queue': 'beat_tasks'},
|
|
|
|
},
|
2013-05-13 18:03:17 -07:00
|
|
|
'activate-next-new-user': {
|
|
|
|
'task': 'activate-next-new-user',
|
2014-04-23 16:12:30 -07:00
|
|
|
'schedule': datetime.timedelta(minutes=5),
|
2013-05-13 18:03:17 -07:00
|
|
|
'options': {'queue': 'beat_tasks'},
|
|
|
|
},
|
2012-07-16 23:40:17 -07:00
|
|
|
}
|
|
|
|
|
2012-09-06 17:16:01 -07:00
|
|
|
# =========
|
|
|
|
# = Mongo =
|
|
|
|
# =========
|
|
|
|
|
|
|
|
MONGO_DB = {
|
2013-08-12 12:26:49 -07:00
|
|
|
'host': 'db_mongo:27017',
|
2012-09-06 17:16:01 -07:00
|
|
|
'name': 'newsblur',
|
|
|
|
}
|
|
|
|
MONGO_ANALYTICS_DB = {
|
2013-08-12 12:26:49 -07:00
|
|
|
'host': 'db_mongo_analytics:27017',
|
2012-09-06 17:16:01 -07:00
|
|
|
'name': 'nbanalytics',
|
|
|
|
}
|
|
|
|
|
2011-02-09 16:28:10 -05:00
|
|
|
# ====================
|
|
|
|
# = Database Routers =
|
|
|
|
# ====================
|
|
|
|
|
|
|
|
class MasterSlaveRouter(object):
|
|
|
|
"""A router that sets up a simple master/slave configuration"""
|
2013-05-08 02:15:55 -07:00
|
|
|
|
2011-02-09 16:28:10 -05:00
|
|
|
def db_for_read(self, model, **hints):
|
|
|
|
"Point all read operations to a random slave"
|
2011-02-09 16:34:05 -05:00
|
|
|
return 'slave'
|
2013-05-08 02:15:55 -07:00
|
|
|
|
2011-02-09 16:28:10 -05:00
|
|
|
def db_for_write(self, model, **hints):
|
|
|
|
"Point all write operations to the master"
|
2011-02-09 16:34:05 -05:00
|
|
|
return 'default'
|
2013-05-08 02:15:55 -07:00
|
|
|
|
2011-02-09 16:28:10 -05:00
|
|
|
def allow_relation(self, obj1, obj2, **hints):
|
|
|
|
"Allow any relation between two objects in the db pool"
|
2011-02-09 16:34:05 -05:00
|
|
|
db_list = ('slave','default')
|
2011-02-09 16:28:10 -05:00
|
|
|
if obj1._state.db in db_list and obj2._state.db in db_list:
|
|
|
|
return True
|
|
|
|
return None
|
2013-05-08 02:15:55 -07:00
|
|
|
|
2020-06-06 23:55:47 -04:00
|
|
|
def allow_migrate(self, db, model):
|
2011-02-09 16:28:10 -05:00
|
|
|
"Explicitly put all models on all databases."
|
|
|
|
return True
|
2011-11-04 09:45:10 -07:00
|
|
|
|
2011-11-05 17:08:31 -07:00
|
|
|
# =========
|
|
|
|
# = Redis =
|
|
|
|
# =========
|
|
|
|
|
|
|
|
REDIS = {
|
2020-06-05 11:00:54 -04:00
|
|
|
'host': '127.0.0.1',
|
2011-11-05 17:08:31 -07:00
|
|
|
}
|
2013-08-12 12:26:49 -07:00
|
|
|
REDIS_PUBSUB = {
|
2020-06-05 11:00:54 -04:00
|
|
|
'host': '127.0.0.1',
|
2013-06-18 12:21:27 -07:00
|
|
|
}
|
2013-08-12 12:26:49 -07:00
|
|
|
REDIS_STORY = {
|
2020-06-05 11:00:54 -04:00
|
|
|
'host': '127.0.0.1',
|
2013-07-01 21:59:09 -07:00
|
|
|
}
|
2015-03-10 19:13:56 -07:00
|
|
|
REDIS_SESSIONS = {
|
2020-06-05 11:00:54 -04:00
|
|
|
'host': '127.0.0.1',
|
2015-03-10 19:13:56 -07:00
|
|
|
}
|
2013-08-12 12:26:49 -07:00
|
|
|
|
2015-12-07 15:38:01 -08:00
|
|
|
CELERY_REDIS_DB_NUM = 4
|
2013-03-20 19:26:10 -07:00
|
|
|
SESSION_REDIS_DB = 5
|
2011-11-05 17:08:31 -07:00
|
|
|
|
2012-03-11 16:13:05 -07:00
|
|
|
# =================
|
|
|
|
# = Elasticsearch =
|
|
|
|
# =================
|
|
|
|
|
2014-04-22 15:15:42 -07:00
|
|
|
ELASTICSEARCH_FEED_HOSTS = ['db_search_feed:9200']
|
|
|
|
ELASTICSEARCH_STORY_HOSTS = ['db_search_story:9200']
|
2012-03-11 16:13:05 -07:00
|
|
|
|
2011-12-20 11:49:49 -08:00
|
|
|
# ===============
|
|
|
|
# = Social APIs =
|
|
|
|
# ===============
|
|
|
|
|
|
|
|
FACEBOOK_APP_ID = '111111111111111'
|
|
|
|
FACEBOOK_SECRET = '99999999999999999999999999999999'
|
2012-10-16 13:40:27 -07:00
|
|
|
FACEBOOK_NAMESPACE = 'newsblur'
|
2011-12-21 09:43:17 -08:00
|
|
|
TWITTER_CONSUMER_KEY = 'ooooooooooooooooooooo'
|
|
|
|
TWITTER_CONSUMER_SECRET = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
|
2015-04-29 16:30:44 -07:00
|
|
|
YOUTUBE_API_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
2011-12-20 11:49:49 -08:00
|
|
|
|
2012-09-18 17:09:07 -07:00
|
|
|
# ===============
|
|
|
|
# = AWS Backing =
|
|
|
|
# ===============
|
|
|
|
|
2013-08-12 12:26:49 -07:00
|
|
|
ORIGINAL_PAGE_SERVER = "db_pages:3060"
|
2012-12-14 16:28:06 -08:00
|
|
|
|
2012-09-18 17:09:07 -07:00
|
|
|
BACKED_BY_AWS = {
|
|
|
|
'pages_on_s3': False,
|
|
|
|
'icons_on_s3': False,
|
|
|
|
}
|
|
|
|
|
2012-09-19 12:15:05 -07:00
|
|
|
PROXY_S3_PAGES = True
|
2012-09-20 12:29:52 -07:00
|
|
|
S3_BACKUP_BUCKET = 'newsblur_backups'
|
|
|
|
S3_PAGES_BUCKET_NAME = 'pages.newsblur.com'
|
|
|
|
S3_ICONS_BUCKET_NAME = 'icons.newsblur.com'
|
2013-01-08 14:11:59 -08:00
|
|
|
S3_AVATARS_BUCKET_NAME = 'avatars.newsblur.com'
|
2012-09-19 12:15:05 -07:00
|
|
|
|
2010-04-05 00:47:21 -04:00
|
|
|
# ==================
|
|
|
|
# = Configurations =
|
|
|
|
# ==================
|
2012-07-16 23:40:17 -07:00
|
|
|
|
2010-04-05 00:47:21 -04:00
|
|
|
from local_settings import *
|
|
|
|
|
2015-12-07 16:55:08 -08:00
|
|
|
if not DEBUG:
|
2013-04-27 14:26:53 -04:00
|
|
|
INSTALLED_APPS += (
|
2015-12-18 15:34:05 -08:00
|
|
|
'raven.contrib.django',
|
2013-08-19 12:17:29 -07:00
|
|
|
'django_ses',
|
2013-04-27 14:26:53 -04:00
|
|
|
|
|
|
|
)
|
2015-12-18 11:15:21 -08:00
|
|
|
# RAVEN_CLIENT = raven.Client(dsn=SENTRY_DSN, release=raven.fetch_git_sha(os.path.dirname(__file__)))
|
2015-12-18 15:34:05 -08:00
|
|
|
RAVEN_CLIENT = raven.Client(SENTRY_DSN)
|
2015-12-07 15:38:01 -08:00
|
|
|
|
2010-04-05 00:47:21 -04:00
|
|
|
COMPRESS = not DEBUG
|
2010-04-09 18:30:25 -04:00
|
|
|
ACCOUNT_ACTIVATION_DAYS = 30
|
2011-09-21 22:08:53 -07:00
|
|
|
AWS_ACCESS_KEY_ID = S3_ACCESS_KEY
|
|
|
|
AWS_SECRET_ACCESS_KEY = S3_SECRET
|
2010-04-06 20:41:00 -04:00
|
|
|
|
2012-09-04 11:46:41 -07:00
|
|
|
os.environ["AWS_ACCESS_KEY_ID"] = AWS_ACCESS_KEY_ID
|
|
|
|
os.environ["AWS_SECRET_ACCESS_KEY"] = AWS_SECRET_ACCESS_KEY
|
|
|
|
|
2010-04-06 20:41:00 -04:00
|
|
|
def custom_show_toolbar(request):
|
|
|
|
return DEBUG
|
|
|
|
|
|
|
|
DEBUG_TOOLBAR_CONFIG = {
|
|
|
|
'INTERCEPT_REDIRECTS': True,
|
|
|
|
'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar,
|
|
|
|
'HIDE_DJANGO_SQL': False,
|
2010-08-21 13:57:39 -04:00
|
|
|
}
|
|
|
|
|
2013-03-26 17:19:17 -07:00
|
|
|
if DEBUG:
|
2020-06-25 17:57:35 -04:00
|
|
|
template_loaders = [
|
2014-01-15 14:29:35 -08:00
|
|
|
'django.template.loaders.filesystem.Loader',
|
|
|
|
'django.template.loaders.app_directories.Loader',
|
2020-06-25 17:57:35 -04:00
|
|
|
]
|
2013-03-26 17:19:17 -07:00
|
|
|
else:
|
2020-06-25 17:57:35 -04:00
|
|
|
template_loaders = [
|
2013-03-26 17:19:17 -07:00
|
|
|
('django.template.loaders.cached.Loader', (
|
|
|
|
'django.template.loaders.filesystem.Loader',
|
|
|
|
'django.template.loaders.app_directories.Loader',
|
|
|
|
)),
|
2020-06-25 17:57:35 -04:00
|
|
|
]
|
2014-01-15 17:49:10 -08:00
|
|
|
|
2020-06-11 04:50:15 -04:00
|
|
|
|
2020-06-25 17:49:01 -04:00
|
|
|
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
2020-06-11 04:50:15 -04:00
|
|
|
|
|
|
|
TEMPLATES = [
|
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
2020-06-29 17:39:55 -04:00
|
|
|
'DIRS': [os.path.join(NEWSBLUR_DIR, 'templates'),
|
|
|
|
os.path.join(NEWSBLUR_DIR, 'vendor/zebra/templates')],
|
2020-06-25 17:57:35 -04:00
|
|
|
# 'APP_DIRS': True,
|
|
|
|
'OPTIONS': {
|
|
|
|
'context_processors': [
|
|
|
|
"django.contrib.auth.context_processors.auth",
|
|
|
|
"django.template.context_processors.debug",
|
|
|
|
"django.template.context_processors.media",
|
|
|
|
'django.template.context_processors.request',
|
|
|
|
],
|
|
|
|
'loaders': template_loaders,
|
|
|
|
},
|
2020-06-11 04:50:15 -04:00
|
|
|
}
|
|
|
|
]
|
2010-08-21 13:57:39 -04:00
|
|
|
# =========
|
|
|
|
# = Mongo =
|
|
|
|
# =========
|
|
|
|
|
2011-08-27 16:22:52 -07:00
|
|
|
MONGO_DB_DEFAULTS = {
|
|
|
|
'name': 'newsblur',
|
2013-08-12 12:26:49 -07:00
|
|
|
'host': 'db_mongo:27017',
|
2012-09-06 17:16:01 -07:00
|
|
|
'alias': 'default',
|
2020-06-29 17:39:55 -04:00
|
|
|
'connect': False,
|
2011-08-27 16:22:52 -07:00
|
|
|
}
|
|
|
|
MONGO_DB = dict(MONGO_DB_DEFAULTS, **MONGO_DB)
|
2020-06-29 17:39:55 -04:00
|
|
|
MONGO_DB_NAME = MONGO_DB.pop('name')
|
2015-07-20 17:31:45 -07:00
|
|
|
# MONGO_URI = 'mongodb://%s' % (MONGO_DB.pop('host'),)
|
2012-10-29 12:25:28 -07:00
|
|
|
|
|
|
|
# if MONGO_DB.get('read_preference', pymongo.ReadPreference.PRIMARY) != pymongo.ReadPreference.PRIMARY:
|
|
|
|
# MONGO_PRIMARY_DB = MONGO_DB.copy()
|
|
|
|
# MONGO_PRIMARY_DB.update(read_preference=pymongo.ReadPreference.PRIMARY)
|
|
|
|
# MONGOPRIMARYDB = connect(MONGO_PRIMARY_DB.pop('name'), **MONGO_PRIMARY_DB)
|
|
|
|
# else:
|
|
|
|
# MONGOPRIMARYDB = MONGODB
|
2015-07-20 17:31:45 -07:00
|
|
|
# MONGODB = connect(MONGO_DB.pop('name'), host=MONGO_URI, **MONGO_DB)
|
2020-06-29 17:39:55 -04:00
|
|
|
MONGODB = connect(MONGO_DB_NAME, **MONGO_DB)
|
2016-11-10 10:11:46 -08:00
|
|
|
# MONGODB = connect(host="mongodb://localhost:27017/newsblur", connect=False)
|
2011-11-05 17:08:31 -07:00
|
|
|
|
2012-09-06 17:16:01 -07:00
|
|
|
MONGO_ANALYTICS_DB_DEFAULTS = {
|
|
|
|
'name': 'nbanalytics',
|
2013-08-12 12:26:49 -07:00
|
|
|
'host': 'db_mongo_analytics:27017',
|
2012-09-06 17:16:01 -07:00
|
|
|
'alias': 'nbanalytics',
|
|
|
|
}
|
|
|
|
MONGO_ANALYTICS_DB = dict(MONGO_ANALYTICS_DB_DEFAULTS, **MONGO_ANALYTICS_DB)
|
2020-06-29 17:39:55 -04:00
|
|
|
MONGO_ANALYTICS_DB_NAME = MONGO_ANALYTICS_DB.pop('name')
|
2015-07-20 17:31:45 -07:00
|
|
|
# MONGO_ANALYTICS_URI = 'mongodb://%s' % (MONGO_ANALYTICS_DB.pop('host'),)
|
|
|
|
# MONGOANALYTICSDB = connect(MONGO_ANALYTICS_DB.pop('name'), host=MONGO_ANALYTICS_URI, **MONGO_ANALYTICS_DB)
|
2020-06-29 17:39:55 -04:00
|
|
|
MONGOANALYTICSDB = connect(MONGO_ANALYTICS_DB_NAME, **MONGO_ANALYTICS_DB)
|
2012-09-06 17:16:01 -07:00
|
|
|
|
2011-11-05 17:08:31 -07:00
|
|
|
# =========
|
|
|
|
# = Redis =
|
|
|
|
# =========
|
|
|
|
|
2020-06-29 17:39:55 -04:00
|
|
|
CELERY_BROKER_URL = "redis://%s:6379/%s" % (REDIS['host'], CELERY_REDIS_DB_NUM)
|
|
|
|
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
|
2020-06-22 12:23:35 -04:00
|
|
|
|
|
|
|
SESSION_REDIS = {
|
|
|
|
'host': REDIS_SESSIONS['host'],
|
|
|
|
'port': 6379,
|
|
|
|
'db': SESSION_REDIS_DB,
|
|
|
|
# 'password': 'password',
|
|
|
|
'prefix': '',
|
|
|
|
'socket_timeout': 10,
|
|
|
|
'retry_on_timeout': True
|
|
|
|
}
|
2015-03-09 16:05:40 -07:00
|
|
|
|
|
|
|
CACHES = {
|
|
|
|
'default': {
|
|
|
|
'BACKEND': 'redis_cache.RedisCache',
|
|
|
|
'LOCATION': '%s:6379' % REDIS['host'],
|
|
|
|
'OPTIONS': {
|
|
|
|
'DB': 6,
|
2020-06-26 18:41:10 -04:00
|
|
|
'PARSER_CLASS': 'redis.connection.HiredisParser',
|
|
|
|
'SERIALIZER_CLASS': 'redis_cache.serializers.PickleSerializer'
|
2015-03-09 16:05:40 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2013-10-07 13:36:10 -07:00
|
|
|
REDIS_POOL = redis.ConnectionPool(host=REDIS['host'], port=6379, db=0)
|
|
|
|
REDIS_ANALYTICS_POOL = redis.ConnectionPool(host=REDIS['host'], port=6379, db=2)
|
|
|
|
REDIS_STATISTICS_POOL = redis.ConnectionPool(host=REDIS['host'], port=6379, db=3)
|
2015-07-27 18:35:25 -07:00
|
|
|
REDIS_FEED_UPDATE_POOL = redis.ConnectionPool(host=REDIS['host'], port=6379, db=4)
|
2015-12-07 16:29:52 -08:00
|
|
|
# REDIS_STORY_HASH_POOL2 = redis.ConnectionPool(host=REDIS['host'], port=6379, db=8) # Only used when changing DAYS_OF_UNREAD
|
2013-10-07 13:36:10 -07:00
|
|
|
REDIS_STORY_HASH_TEMP_POOL = redis.ConnectionPool(host=REDIS['host'], port=6379, db=10)
|
2015-07-27 18:35:25 -07:00
|
|
|
# REDIS_CACHE_POOL = redis.ConnectionPool(host=REDIS['host'], port=6379, db=6) # Duped in CACHES
|
|
|
|
REDIS_STORY_HASH_POOL = redis.ConnectionPool(host=REDIS_STORY['host'], port=6379, db=1)
|
2020-06-22 12:23:35 -04:00
|
|
|
REDIS_FEED_READ_POOL = redis.ConnectionPool(host=REDIS_SESSIONS['host'], port=6379, db=1)
|
|
|
|
REDIS_FEED_SUB_POOL = redis.ConnectionPool(host=REDIS_SESSIONS['host'], port=6379, db=2)
|
|
|
|
REDIS_SESSION_POOL = redis.ConnectionPool(host=REDIS_SESSIONS['host'], port=6379, db=5)
|
2015-07-27 18:35:25 -07:00
|
|
|
REDIS_PUBSUB_POOL = redis.ConnectionPool(host=REDIS_PUBSUB['host'], port=6379, db=0)
|
2013-07-01 21:59:09 -07:00
|
|
|
|
2015-12-07 15:38:01 -08:00
|
|
|
# ==========
|
|
|
|
# = Celery =
|
|
|
|
# ==========
|
|
|
|
|
2015-12-18 11:16:21 -08:00
|
|
|
# celeryapp.autodiscover_tasks(INSTALLED_APPS)
|
2015-12-07 15:38:01 -08:00
|
|
|
CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']
|
|
|
|
|
2013-06-18 12:21:27 -07:00
|
|
|
# ==========
|
|
|
|
# = Assets =
|
|
|
|
# ==========
|
|
|
|
|
2020-06-29 17:39:55 -04:00
|
|
|
JAMMIT = jammit.JammitAssets(ROOT_DIR)
|
2012-04-06 18:28:26 -07:00
|
|
|
|
|
|
|
if DEBUG:
|
2012-07-28 13:16:18 -07:00
|
|
|
MIDDLEWARE_CLASSES += ('utils.request_introspection_middleware.DumpRequestMiddleware',)
|
2012-08-24 18:07:44 -07:00
|
|
|
MIDDLEWARE_CLASSES += ('utils.exception_middleware.ConsoleExceptionMiddleware',)
|
2012-07-16 23:40:17 -07:00
|
|
|
|
2012-09-18 17:09:07 -07:00
|
|
|
# =======
|
|
|
|
# = AWS =
|
|
|
|
# =======
|
|
|
|
|
|
|
|
S3_CONN = None
|
2017-03-01 16:23:45 -05:00
|
|
|
if BACKED_BY_AWS.get('pages_on_s3') or BACKED_BY_AWS.get('icons_on_s3'):
|
|
|
|
S3_CONN = S3Connection(S3_ACCESS_KEY, S3_SECRET, calling_format=OrdinaryCallingFormat())
|
2017-03-28 10:47:25 -07:00
|
|
|
# if BACKED_BY_AWS.get('pages_on_s3'):
|
|
|
|
# S3_PAGES_BUCKET = S3_CONN.get_bucket(S3_PAGES_BUCKET_NAME)
|
|
|
|
# if BACKED_BY_AWS.get('icons_on_s3'):
|
|
|
|
# S3_ICONS_BUCKET = S3_CONN.get_bucket(S3_ICONS_BUCKET_NAME)
|
2013-03-20 17:00:58 -07:00
|
|
|
|
2013-03-25 12:32:15 -07:00
|
|
|
django.http.request.host_validation_re = re.compile(r"^([a-z0-9.-_\-]+|\[[a-f0-9]*:[a-f0-9:]+\])(:\d+)?$")
|