2013-12-11 17:08:21 +01:00
|
|
|
# Django settings for zulip project.
|
2013-09-24 20:28:28 +02:00
|
|
|
#
|
|
|
|
# DO NOT PUT ANY SECRETS IN THIS FILE.
|
|
|
|
# Those belong in local_settings.py.
|
2012-08-28 18:45:32 +02:00
|
|
|
import os
|
2012-09-17 23:30:29 +02:00
|
|
|
import platform
|
2013-03-26 22:08:25 +01:00
|
|
|
import time
|
2013-09-26 23:06:01 +02:00
|
|
|
import sys
|
2013-11-01 00:00:30 +01:00
|
|
|
import ConfigParser
|
2012-08-28 18:44:51 +02:00
|
|
|
|
2013-07-29 23:03:31 +02:00
|
|
|
from zerver.openid import openid_failure_handler
|
2014-01-07 22:20:29 +01:00
|
|
|
from zerver.lib.db import TimeTrackingConnection
|
2013-02-20 22:26:06 +01:00
|
|
|
|
2013-11-01 00:00:30 +01:00
|
|
|
config_file = ConfigParser.RawConfigParser()
|
|
|
|
config_file.read("/etc/zulip/zulip.conf")
|
|
|
|
|
2013-10-25 21:19:30 +02:00
|
|
|
# Whether we're running in a production environment. Note that DEPLOYED does
|
2013-11-12 18:14:02 +01:00
|
|
|
# **not** mean hosted by us; customer sites are DEPLOYED and ENTERPRISE
|
2013-10-25 21:19:30 +02:00
|
|
|
# and as such should not for example assume they are the main Zulip site.
|
2013-11-01 00:00:30 +01:00
|
|
|
DEPLOYED = config_file.has_option('machine', 'deploy_type')
|
|
|
|
STAGING_DEPLOYED = DEPLOYED and config_file.get('machine', 'deploy_type') == 'staging'
|
|
|
|
TESTING_DEPLOYED = DEPLOYED and config_file.get('machine', 'deploy_type') == 'test'
|
2013-10-25 21:19:30 +02:00
|
|
|
|
2013-11-12 18:16:36 +01:00
|
|
|
ENTERPRISE = DEPLOYED and config_file.get('machine', 'deploy_type') == 'enterprise'
|
2013-10-25 21:19:30 +02:00
|
|
|
|
2013-09-24 20:28:28 +02:00
|
|
|
# Import variables like secrets from the local_settings file
|
2013-10-25 21:19:30 +02:00
|
|
|
# Import local_settings after determining the deployment/machine type
|
2013-09-24 20:28:28 +02:00
|
|
|
from local_settings import *
|
2013-03-26 22:08:25 +01:00
|
|
|
|
2013-09-24 20:28:28 +02:00
|
|
|
SERVER_GENERATION = int(time.time())
|
2012-09-17 23:30:29 +02:00
|
|
|
|
2013-11-12 20:37:23 +01:00
|
|
|
if not 'DEBUG' in globals():
|
|
|
|
# Uncomment end of next line to test JS/CSS minification.
|
|
|
|
DEBUG = not DEPLOYED # and platform.node() != 'your-machine'
|
|
|
|
|
2012-08-28 18:44:51 +02:00
|
|
|
TEMPLATE_DEBUG = DEBUG
|
2013-01-11 21:16:42 +01:00
|
|
|
TEST_SUITE = False
|
2012-08-28 18:44:51 +02:00
|
|
|
|
2014-01-07 22:27:52 +01:00
|
|
|
if len(sys.argv) > 2 and sys.argv[0].endswith('manage.py') and sys.argv[1] == 'process_queue':
|
|
|
|
IS_WORKER = True
|
|
|
|
else:
|
|
|
|
IS_WORKER = False
|
|
|
|
|
2012-09-19 22:25:13 +02:00
|
|
|
if DEBUG:
|
|
|
|
INTERNAL_IPS = ('127.0.0.1',)
|
2013-11-12 18:14:02 +01:00
|
|
|
if TESTING_DEPLOYED or ENTERPRISE:
|
|
|
|
# XXX we should probably tighten this for ENTERPRISE
|
2013-09-23 16:59:18 +02:00
|
|
|
# Allow any hosts for our test instances, to reduce 500 spam
|
|
|
|
ALLOWED_HOSTS = ['*']
|
|
|
|
elif DEPLOYED:
|
2013-07-22 21:52:22 +02:00
|
|
|
# The IP addresses are for app.zulip.{com,net} and staging.zulip.{com,net}
|
|
|
|
ALLOWED_HOSTS = ['localhost', '.humbughq.com', '54.214.48.144', '54.213.44.54',
|
|
|
|
'54.213.41.54', '54.213.44.58', '54.213.44.73',
|
2013-12-02 19:24:07 +01:00
|
|
|
'54.200.19.65', '54.201.95.104', '54.201.95.206',
|
2013-12-19 22:51:43 +01:00
|
|
|
'54.201.186.29', "54.200.111.22",
|
2013-07-22 21:52:22 +02:00
|
|
|
'54.245.120.64', '54.213.44.83', '.zulip.com', '.zulip.net']
|
2013-03-26 22:35:53 +01:00
|
|
|
else:
|
|
|
|
ALLOWED_HOSTS = ['localhost']
|
2012-09-19 22:25:13 +02:00
|
|
|
|
2013-03-05 22:58:39 +01:00
|
|
|
DATABASES = {"default": {
|
|
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
2013-10-26 02:23:40 +02:00
|
|
|
'NAME': 'zulip',
|
|
|
|
'USER': 'zulip',
|
2013-03-05 22:58:39 +01:00
|
|
|
'PASSWORD': '', # Authentication done via certificates
|
2013-10-26 02:23:40 +02:00
|
|
|
'HOST': 'postgres.zulip.net',
|
|
|
|
'SCHEMA': 'zulip',
|
2013-11-08 17:35:40 +01:00
|
|
|
'CONN_MAX_AGE': 600,
|
2013-03-05 22:58:39 +01:00
|
|
|
'OPTIONS': {
|
2013-03-18 21:53:13 +01:00
|
|
|
'sslmode': 'verify-full',
|
2013-11-01 18:44:16 +01:00
|
|
|
'autocommit': True,
|
2014-01-07 22:20:29 +01:00
|
|
|
'connection_factory': TimeTrackingConnection
|
2012-09-14 19:22:56 +02:00
|
|
|
},
|
2012-09-14 19:17:26 +02:00
|
|
|
},
|
2012-09-14 22:29:53 +02:00
|
|
|
}
|
|
|
|
|
2013-11-12 18:14:02 +01:00
|
|
|
if ENTERPRISE:
|
2013-11-10 18:14:11 +01:00
|
|
|
DATABASES["default"].update({
|
2013-11-13 04:26:11 +01:00
|
|
|
# Host = '' => connect through a local socket
|
|
|
|
'HOST': '',
|
2013-11-10 18:14:11 +01:00
|
|
|
'OPTIONS': {
|
|
|
|
'autocommit': True,
|
2014-01-07 22:20:29 +01:00
|
|
|
'connection_factory': TimeTrackingConnection
|
2013-11-10 18:14:11 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
elif not DEPLOYED:
|
2013-06-12 16:46:25 +02:00
|
|
|
DATABASES["default"].update({
|
2013-09-25 21:51:23 +02:00
|
|
|
'PASSWORD': LOCAL_DATABASE_PASSWORD,
|
2013-06-12 16:46:25 +02:00
|
|
|
'HOST': 'localhost',
|
2013-11-01 18:44:16 +01:00
|
|
|
'OPTIONS': {
|
|
|
|
'autocommit': True,
|
2014-01-07 22:20:29 +01:00
|
|
|
'connection_factory': TimeTrackingConnection
|
2013-11-01 18:44:16 +01:00
|
|
|
}
|
2013-06-12 16:46:25 +02:00
|
|
|
})
|
2013-08-06 22:19:25 +02:00
|
|
|
INTERNAL_ZULIP_USERS = []
|
2012-08-28 18:44:51 +02:00
|
|
|
|
|
|
|
# Local time zone for this installation. Choices can be found here:
|
|
|
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
|
|
|
# although not all choices may be available on all operating systems.
|
|
|
|
# In a Windows environment this must be set to your system time zone.
|
2012-09-12 22:40:18 +02:00
|
|
|
TIME_ZONE = 'America/New_York'
|
2012-08-28 18:44:51 +02:00
|
|
|
|
|
|
|
# Language code for this installation. All choices can be found here:
|
|
|
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
|
2012-11-01 23:11:32 +01:00
|
|
|
# The ID, as an integer, of the current site in the django_site database table.
|
|
|
|
# This is used so that application data can hook into specific site(s) and a
|
|
|
|
# single database can manage content for multiple sites.
|
|
|
|
#
|
2013-07-22 21:52:22 +02:00
|
|
|
# We set this site's domain to 'zulip.com' in populate_db.
|
2012-08-28 18:44:51 +02:00
|
|
|
SITE_ID = 1
|
|
|
|
|
|
|
|
# If you set this to False, Django will make some optimizations so as not
|
|
|
|
# to load the internationalization machinery.
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
# If you set this to False, Django will not format dates, numbers and
|
|
|
|
# calendars according to the current locale.
|
|
|
|
USE_L10N = True
|
|
|
|
|
|
|
|
# If you set this to False, Django will not use timezone-aware datetimes.
|
|
|
|
USE_TZ = True
|
|
|
|
|
2013-06-24 20:56:44 +02:00
|
|
|
DEPLOY_ROOT = os.path.join(os.path.realpath(os.path.dirname(__file__)), '..')
|
|
|
|
TEMPLATE_DIRS = ( os.path.join(DEPLOY_ROOT, 'templates'), )
|
2012-08-28 18:44:51 +02:00
|
|
|
|
|
|
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
|
|
|
# trailing slash.
|
|
|
|
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
|
|
|
|
MEDIA_URL = ''
|
|
|
|
|
2012-10-17 22:35:35 +02:00
|
|
|
# Tell the browser to never send our cookies without encryption, e.g.
|
|
|
|
# when executing the initial http -> https redirect.
|
|
|
|
#
|
|
|
|
# Turn it off for local testing because we don't have SSL.
|
2012-12-11 22:07:57 +01:00
|
|
|
if DEPLOYED:
|
2012-10-17 22:35:35 +02:00
|
|
|
SESSION_COOKIE_SECURE = True
|
|
|
|
CSRF_COOKIE_SECURE = True
|
|
|
|
|
2014-01-16 22:03:48 +01:00
|
|
|
try:
|
|
|
|
# For get_updates hostname sharding
|
|
|
|
domain = config_file.get('django', 'cookie_domain')
|
|
|
|
SESSION_COOKIE_DOMAIN = '.' + domain
|
|
|
|
CSRF_COOKIE_DOMAIN = '.' + domain
|
|
|
|
except ConfigParser.Error:
|
|
|
|
# Failing here is OK
|
|
|
|
pass
|
|
|
|
|
2012-10-26 21:57:13 +02:00
|
|
|
# Prevent Javascript from reading the CSRF token from cookies. Our code gets
|
|
|
|
# the token from the DOM, which means malicious code could too. But hiding the
|
|
|
|
# cookie will slow down some attackers.
|
|
|
|
CSRF_COOKIE_PATH = '/;HttpOnly'
|
2013-12-17 22:18:13 +01:00
|
|
|
CSRF_FAILURE_VIEW = 'zerver.middleware.csrf_failure'
|
2012-10-26 21:57:13 +02:00
|
|
|
|
2012-11-08 21:49:04 +01:00
|
|
|
# Base URL of the Tornado server
|
2012-11-08 23:23:25 +01:00
|
|
|
# We set it to None when running backend tests or populate_db.
|
|
|
|
# We override the port number when running frontend tests.
|
2012-11-08 21:49:04 +01:00
|
|
|
TORNADO_SERVER = 'http://localhost:9993'
|
2013-01-09 22:45:23 +01:00
|
|
|
RUNNING_INSIDE_TORNADO = False
|
2012-10-09 22:21:03 +02:00
|
|
|
|
2012-10-09 23:52:48 +02:00
|
|
|
# Make redirects work properly behind a reverse proxy
|
|
|
|
USE_X_FORWARDED_HOST = True
|
|
|
|
|
2012-08-28 18:44:51 +02:00
|
|
|
# List of callables that know how to import templates from various sources.
|
|
|
|
TEMPLATE_LOADERS = (
|
2013-11-15 20:51:37 +01:00
|
|
|
'django.template.loaders.filesystem.Loader',
|
|
|
|
'django.template.loaders.app_directories.Loader',
|
|
|
|
)
|
|
|
|
if DEPLOYED:
|
|
|
|
TEMPLATE_LOADERS = (
|
|
|
|
('django.template.loaders.cached.Loader',
|
|
|
|
TEMPLATE_LOADERS),
|
|
|
|
)
|
2012-08-28 18:44:51 +02:00
|
|
|
|
|
|
|
MIDDLEWARE_CLASSES = (
|
2012-11-14 21:00:26 +01:00
|
|
|
# Our logging middleware should be the first middleware item.
|
2013-12-17 22:18:13 +01:00
|
|
|
'zerver.middleware.TagRequests',
|
2013-07-29 23:03:31 +02:00
|
|
|
'zerver.middleware.LogRequests',
|
|
|
|
'zerver.middleware.JsonErrorHandler',
|
|
|
|
'zerver.middleware.RateLimitMiddleware',
|
2013-11-08 21:13:34 +01:00
|
|
|
'zerver.middleware.FlushDisplayRecipientCache',
|
2012-08-28 18:44:51 +02:00
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
)
|
|
|
|
|
2013-06-22 00:05:48 +02:00
|
|
|
ANONYMOUS_USER_ID = None
|
|
|
|
|
2013-07-29 23:03:31 +02:00
|
|
|
AUTH_USER_MODEL = "zerver.UserProfile"
|
2012-09-21 16:10:36 +02:00
|
|
|
|
2014-01-29 00:47:48 +01:00
|
|
|
TEST_RUNNER = 'zerver.lib.test_runner.Runner'
|
2012-11-14 20:50:47 +01:00
|
|
|
|
2013-08-06 22:51:47 +02:00
|
|
|
ROOT_URLCONF = 'zproject.urls'
|
2012-08-28 18:44:51 +02:00
|
|
|
|
|
|
|
# Python dotted path to the WSGI application used by Django's runserver.
|
2013-08-06 22:51:47 +02:00
|
|
|
WSGI_APPLICATION = 'zproject.wsgi.application'
|
2012-08-28 18:44:51 +02:00
|
|
|
|
2013-11-06 21:09:52 +01:00
|
|
|
INSTALLED_APPS = [
|
2012-08-28 18:44:51 +02:00
|
|
|
'django.contrib.auth',
|
2013-08-06 22:51:47 +02:00
|
|
|
'zproject.authhack',
|
2012-08-28 18:44:51 +02:00
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.sites',
|
2013-01-30 23:11:34 +01:00
|
|
|
'django.contrib.staticfiles',
|
2013-01-02 19:42:00 +01:00
|
|
|
'south',
|
2013-02-20 22:26:06 +01:00
|
|
|
'django_openid_auth',
|
2012-09-28 22:47:05 +02:00
|
|
|
'confirmation',
|
2013-06-22 00:05:48 +02:00
|
|
|
'guardian',
|
2013-01-30 23:11:34 +01:00
|
|
|
'pipeline',
|
2013-07-29 23:03:31 +02:00
|
|
|
'zerver',
|
2013-11-06 21:09:52 +01:00
|
|
|
]
|
|
|
|
|
2013-11-12 18:14:02 +01:00
|
|
|
if not ENTERPRISE:
|
2013-11-06 21:09:52 +01:00
|
|
|
INSTALLED_APPS += [
|
|
|
|
'analytics',
|
|
|
|
'zilencer',
|
|
|
|
]
|
2012-08-28 18:44:51 +02:00
|
|
|
|
2013-04-16 22:51:14 +02:00
|
|
|
LOCAL_STATSD = (False)
|
2013-11-12 18:14:02 +01:00
|
|
|
USING_STATSD = (DEPLOYED and not TESTING_DEPLOYED and not ENTERPRISE) or LOCAL_STATSD
|
2013-04-16 22:51:14 +02:00
|
|
|
|
2013-09-30 17:53:46 +02:00
|
|
|
# These must be named STATSD_PREFIX for the statsd module
|
|
|
|
# to pick them up
|
|
|
|
if STAGING_DEPLOYED:
|
|
|
|
STATSD_PREFIX = 'staging'
|
|
|
|
elif DEPLOYED:
|
|
|
|
STATSD_PREFIX = 'app'
|
|
|
|
else:
|
|
|
|
STATSD_PREFIX = 'user'
|
|
|
|
|
2013-04-16 22:51:14 +02:00
|
|
|
if USING_STATSD:
|
|
|
|
if LOCAL_STATSD:
|
|
|
|
STATSD_HOST = 'localhost'
|
|
|
|
else:
|
2013-08-21 23:47:17 +02:00
|
|
|
STATSD_HOST = 'stats.zulip.net'
|
2013-04-16 22:51:14 +02:00
|
|
|
|
2013-11-06 21:09:52 +01:00
|
|
|
INSTALLED_APPS += ['django_statsd']
|
2013-04-16 22:51:14 +02:00
|
|
|
STATSD_PORT = 8125
|
|
|
|
STATSD_CLIENT = 'django_statsd.clients.normal'
|
|
|
|
|
2013-05-29 23:58:07 +02:00
|
|
|
RATE_LIMITING = True
|
|
|
|
REDIS_HOST = '127.0.0.1'
|
|
|
|
REDIS_PORT = 6379
|
|
|
|
|
|
|
|
RATE_LIMITING_RULES = [
|
|
|
|
(60, 100), # 100 requests max every minute
|
|
|
|
]
|
|
|
|
|
2013-10-23 23:39:22 +02:00
|
|
|
# For any settings that are not defined in local_settings.py,
|
|
|
|
# we want to initialize them to sane default
|
|
|
|
DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
|
|
|
|
'TWITTER_CONSUMER_SECRET': '',
|
|
|
|
'TWITTER_ACCESS_TOKEN_KEY': '',
|
|
|
|
'TWITTER_ACCESS_TOKEN_SECRET': '',
|
2013-10-25 17:35:27 +02:00
|
|
|
'EMBEDLY_KEY': '',
|
2013-11-12 16:19:38 +01:00
|
|
|
'EMAIL_GATEWAY_PATTERN': '',
|
2013-12-18 20:11:40 +01:00
|
|
|
'EMAIL_GATEWAY_EXAMPLE': '',
|
2013-11-01 21:43:20 +01:00
|
|
|
'EMAIL_GATEWAY_BOT': None,
|
2013-10-25 17:35:27 +02:00
|
|
|
'EMAIL_GATEWAY_LOGIN': None,
|
|
|
|
'EMAIL_GATEWAY_PASSWORD': None,
|
|
|
|
'EMAIL_GATEWAY_IMAP_SERVER': None,
|
|
|
|
'EMAIL_GATEWAY_IMAP_PORT': None,
|
2013-10-25 21:19:30 +02:00
|
|
|
'EMAIL_GATEWAY_IMAP_FOLDER': None,
|
|
|
|
'MANDRILL_API_KEY': '',
|
|
|
|
'S3_KEY': '',
|
|
|
|
'S3_SECRET_KEY': '',
|
|
|
|
'S3_BUCKET': '',
|
|
|
|
'S3_AVATAR_BUCKET': '',
|
|
|
|
'MIXPANEL_TOKEN': '',
|
|
|
|
'MAILCHIMP_API_KEY': '',
|
2013-10-28 16:13:53 +01:00
|
|
|
'LOCAL_UPLOADS_DIR': None,
|
2013-10-31 18:33:19 +01:00
|
|
|
'DROPBOX_APP_KEY': '',
|
2013-11-13 21:35:04 +01:00
|
|
|
'ERROR_REPORTING': True,
|
2013-11-15 16:52:31 +01:00
|
|
|
'NAME_CHANGES_DISABLED': False,
|
2013-11-14 18:38:09 +01:00
|
|
|
'DEPLOYMENT_ROLE_NAME': ADMIN_DOMAIN,
|
2013-11-12 18:14:02 +01:00
|
|
|
# The following bots only exist in non-ENTERPRISE installs
|
2013-10-31 18:33:19 +01:00
|
|
|
'ERROR_BOT': None,
|
2013-11-01 14:51:36 +01:00
|
|
|
'NEW_USER_BOT': None,
|
|
|
|
'NAGIOS_STAGING_SEND_BOT': None,
|
2013-11-04 19:37:05 +01:00
|
|
|
'NAGIOS_STAGING_RECEIVE_BOT': None,
|
2013-11-10 17:36:33 +01:00
|
|
|
'APNS_CERT_FILE': None,
|
2013-12-09 23:19:59 +01:00
|
|
|
'ANDROID_GCM_API_KEY': None,
|
2013-11-13 16:59:27 +01:00
|
|
|
'INITIAL_PASSWORD_SALT': None,
|
|
|
|
'FEEDBACK_BOT': 'feedback@zulip.com',
|
|
|
|
'FEEDBACK_BOT_NAME': 'Zulip Feedback Bot',
|
2013-11-12 23:22:08 +01:00
|
|
|
'API_SUPER_USERS': set(),
|
2013-11-13 19:55:04 +01:00
|
|
|
'ADMINS': '',
|
2013-11-14 14:37:39 +01:00
|
|
|
'INLINE_IMAGE_PREVIEW': True,
|
2013-11-15 19:53:04 +01:00
|
|
|
'CAMO_URI': None,
|
2013-11-12 23:22:08 +01:00
|
|
|
'ENABLE_FEEDBACK': True,
|
2013-11-25 22:07:37 +01:00
|
|
|
'FEEDBACK_EMAIL': None,
|
2013-11-15 22:25:02 +01:00
|
|
|
'ENABLE_GRAVATAR': True,
|
2013-11-18 16:58:39 +01:00
|
|
|
'DEFAULT_AVATAR_URI': '/static/images/default-avatar.png',
|
2013-11-26 01:14:36 +01:00
|
|
|
'AUTH_LDAP_SERVER_URI': "",
|
2013-12-12 20:30:43 +01:00
|
|
|
'EXTERNAL_URI_SCHEME': "https://",
|
2014-01-13 22:24:08 +01:00
|
|
|
'GOOGLE_CLIENT_ID': '',
|
2014-02-05 01:05:27 +01:00
|
|
|
'REDIS_PASSWORD': None,
|
2013-10-29 20:44:49 +01:00
|
|
|
}
|
2013-10-23 23:39:22 +02:00
|
|
|
|
|
|
|
for setting_name, setting_val in DEFAULT_SETTINGS.iteritems():
|
|
|
|
if not setting_name in vars():
|
|
|
|
vars()[setting_name] = setting_val
|
|
|
|
|
2013-11-13 19:55:04 +01:00
|
|
|
if ADMINS == "":
|
|
|
|
ADMINS = (("Zulip Administrator", ZULIP_ADMINISTRATOR),)
|
|
|
|
MANAGERS = ADMINS
|
|
|
|
|
2013-11-13 05:38:54 +01:00
|
|
|
# These are the settings that manage.py checkconfig will check that
|
|
|
|
# user has filled in before starting the app. It consists of a series
|
|
|
|
# of pairs of (setting name, default value that it must be changed from)
|
|
|
|
REQUIRED_SETTINGS = [("EXTERNAL_HOST", ""),
|
|
|
|
("ZULIP_ADMINISTRATOR", ""),
|
|
|
|
("ADMIN_DOMAIN", ""),
|
|
|
|
("DEPLOYMENT_ROLE_KEY", ""),
|
|
|
|
# SECRET_KEY doesn't really need to be here, in
|
|
|
|
# that we set it automatically, but just in
|
|
|
|
# case, it seems worth having in this list
|
|
|
|
("SECRET_KEY", ""),
|
|
|
|
("AUTHENTICATION_BACKENDS", ()),
|
2013-11-16 00:47:17 +01:00
|
|
|
("NOREPLY_EMAIL_ADDRESS", ""),
|
|
|
|
("DEFAULT_FROM_EMAIL", ""),
|
2013-11-13 05:38:54 +01:00
|
|
|
]
|
|
|
|
|
2013-12-04 20:38:01 +01:00
|
|
|
if "EXTERNAL_API_PATH" not in vars():
|
|
|
|
EXTERNAL_API_PATH = EXTERNAL_HOST + "/api"
|
|
|
|
EXTERNAL_API_URI = EXTERNAL_URI_SCHEME + EXTERNAL_API_PATH
|
|
|
|
|
2013-11-14 16:59:10 +01:00
|
|
|
INTERNAL_BOTS = [ {'var_name': 'NOTIFICATION_BOT',
|
|
|
|
'email_template': 'notification-bot@%s',
|
|
|
|
'name': 'Notification Bot'},
|
|
|
|
{'var_name': 'EMAIL_GATEWAY_BOT',
|
|
|
|
'email_template': 'emailgateway@%s',
|
|
|
|
'name': 'Email Gateway'},
|
|
|
|
{'var_name': 'NAGIOS_SEND_BOT',
|
|
|
|
'email_template': 'nagios-send-bot@%s',
|
|
|
|
'name': 'Nagios Send Bot'},
|
|
|
|
{'var_name': 'NAGIOS_RECEIVE_BOT',
|
|
|
|
'email_template': 'nagios-receive-bot@%s',
|
2014-01-15 00:06:20 +01:00
|
|
|
'name': 'Nagios Receive Bot'},
|
|
|
|
{'var_name': 'WELCOME_BOT',
|
|
|
|
'email_template': 'welcome-bot@%s',
|
|
|
|
'name': 'Welcome Bot'} ]
|
2013-11-14 16:59:10 +01:00
|
|
|
|
|
|
|
INTERNAL_BOT_DOMAIN = "zulip.com"
|
2013-10-31 18:33:19 +01:00
|
|
|
|
|
|
|
# Set the realm-specific bot names
|
2013-11-14 16:59:10 +01:00
|
|
|
for bot in INTERNAL_BOTS:
|
2013-10-31 18:33:19 +01:00
|
|
|
if not bot['var_name'] in vars():
|
2013-11-14 16:59:10 +01:00
|
|
|
bot_email = bot['email_template'] % (INTERNAL_BOT_DOMAIN,)
|
2013-10-31 18:33:19 +01:00
|
|
|
vars()[bot['var_name'] ] = bot_email
|
|
|
|
|
2013-11-12 23:31:52 +01:00
|
|
|
if EMAIL_GATEWAY_BOT not in API_SUPER_USERS:
|
|
|
|
API_SUPER_USERS.add(EMAIL_GATEWAY_BOT)
|
2013-12-04 22:37:49 +01:00
|
|
|
if EMAIL_GATEWAY_PATTERN != "":
|
|
|
|
EMAIL_GATEWAY_EXAMPLE = EMAIL_GATEWAY_PATTERN % ("support+abcdefg",)
|
2013-11-12 23:31:52 +01:00
|
|
|
|
2013-11-12 23:37:00 +01:00
|
|
|
if DEPLOYED:
|
|
|
|
FEEDBACK_TARGET="https://staging.zulip.com/api"
|
|
|
|
else:
|
|
|
|
FEEDBACK_TARGET="http://localhost:9991/api"
|
|
|
|
|
2013-01-30 23:11:34 +01:00
|
|
|
# Static files and minification
|
|
|
|
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
|
2013-08-06 21:36:30 +02:00
|
|
|
# ZulipStorage is a modified version of PipelineCachedStorage,
|
2013-06-20 19:44:44 +02:00
|
|
|
# and, like that class, it inserts a file hash into filenames
|
2013-02-24 19:28:43 +01:00
|
|
|
# to prevent the browser from using stale files from cache.
|
2013-02-25 23:19:20 +01:00
|
|
|
#
|
|
|
|
# Unlike PipelineStorage, it requires the files to exist in
|
|
|
|
# STATIC_ROOT even for dev servers. So we only use
|
2013-08-06 21:36:30 +02:00
|
|
|
# ZulipStorage when not DEBUG.
|
2013-02-25 23:19:20 +01:00
|
|
|
|
2013-07-26 20:14:54 +02:00
|
|
|
# This is the default behavior from Pipeline, but we set it
|
|
|
|
# here so that urls.py can read it.
|
|
|
|
PIPELINE = not DEBUG
|
|
|
|
|
2013-11-12 20:37:23 +01:00
|
|
|
if DEBUG:
|
2013-02-25 23:19:20 +01:00
|
|
|
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
|
2013-06-12 19:33:53 +02:00
|
|
|
STATICFILES_FINDERS = (
|
|
|
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
|
|
|
)
|
2013-07-26 20:14:54 +02:00
|
|
|
if PIPELINE:
|
|
|
|
STATIC_ROOT = 'prod-static/serve'
|
|
|
|
else:
|
|
|
|
STATIC_ROOT = 'static/'
|
2013-02-25 23:19:20 +01:00
|
|
|
else:
|
2013-08-06 21:36:30 +02:00
|
|
|
STATICFILES_STORAGE = 'zerver.storage.ZulipStorage'
|
2013-06-12 19:33:53 +02:00
|
|
|
STATICFILES_FINDERS = (
|
2013-08-06 21:37:02 +02:00
|
|
|
'zerver.finders.ZulipFinder',
|
2013-06-12 19:33:53 +02:00
|
|
|
)
|
2013-11-12 18:14:02 +01:00
|
|
|
if DEPLOYED or ENTERPRISE:
|
2013-10-04 19:19:57 +02:00
|
|
|
STATIC_ROOT = '/home/zulip/prod-static'
|
2013-06-12 19:56:12 +02:00
|
|
|
else:
|
|
|
|
STATIC_ROOT = 'prod-static/serve'
|
2013-01-30 23:11:34 +01:00
|
|
|
|
2013-07-25 22:41:44 +02:00
|
|
|
STATICFILES_DIRS = ['static/']
|
2013-07-29 23:03:31 +02:00
|
|
|
STATIC_HEADER_FILE = 'zerver/static_header.txt'
|
2013-01-30 23:11:34 +01:00
|
|
|
|
2013-06-24 16:45:57 +02:00
|
|
|
# To use minified files in dev, set PIPELINE = True. For the full
|
|
|
|
# cache-busting behavior, you must also set DEBUG = False.
|
2013-02-24 19:57:01 +01:00
|
|
|
#
|
2013-10-25 23:20:40 +02:00
|
|
|
# You will need to run update-prod-static after changing
|
2013-06-24 16:45:57 +02:00
|
|
|
# static files.
|
2013-02-24 19:57:01 +01:00
|
|
|
|
2013-01-30 23:11:34 +01:00
|
|
|
PIPELINE_CSS = {
|
2013-02-25 02:59:59 +01:00
|
|
|
'activity': {
|
|
|
|
'source_filenames': ('styles/activity.css',),
|
|
|
|
'output_filename': 'min/activity.css'
|
|
|
|
},
|
|
|
|
'portico': {
|
|
|
|
'source_filenames': (
|
2013-05-28 21:46:16 +02:00
|
|
|
'third/zocial/zocial.css',
|
2013-02-25 02:59:59 +01:00
|
|
|
'styles/portico.css',
|
|
|
|
'styles/pygments.css',
|
2013-07-23 00:18:28 +02:00
|
|
|
'styles/thirdparty-fonts.css',
|
2013-04-22 00:50:18 +02:00
|
|
|
'styles/fonts.css',
|
2013-02-25 02:59:59 +01:00
|
|
|
),
|
|
|
|
'output_filename': 'min/portico.css'
|
|
|
|
},
|
2013-07-01 20:13:26 +02:00
|
|
|
# Two versions of the app CSS exist because of QTBUG-3467
|
|
|
|
'app-fontcompat': {
|
|
|
|
'source_filenames': (
|
|
|
|
'third/bootstrap-notify/css/bootstrap-notify.css',
|
|
|
|
'third/spectrum/spectrum.css',
|
2013-07-25 22:34:39 +02:00
|
|
|
'styles/zulip.css',
|
2013-07-01 20:13:26 +02:00
|
|
|
'styles/pygments.css',
|
|
|
|
'styles/thirdparty-fonts.css',
|
|
|
|
# We don't want fonts.css on QtWebKit, so its omitted here
|
|
|
|
),
|
|
|
|
'output_filename': 'min/app-fontcompat.css'
|
|
|
|
},
|
2013-01-30 23:11:34 +01:00
|
|
|
'app': {
|
|
|
|
'source_filenames': (
|
2013-06-19 01:41:27 +02:00
|
|
|
'third/bootstrap-notify/css/bootstrap-notify.css',
|
2013-05-28 21:46:16 +02:00
|
|
|
'third/spectrum/spectrum.css',
|
2014-02-27 21:58:40 +01:00
|
|
|
'third/jquery-perfect-scrollbar/css/perfect-scrollbar.css',
|
2013-07-25 22:34:39 +02:00
|
|
|
'styles/zulip.css',
|
2013-01-30 23:11:34 +01:00
|
|
|
'styles/pygments.css',
|
2013-07-01 20:13:26 +02:00
|
|
|
'styles/thirdparty-fonts.css',
|
2013-04-22 00:50:18 +02:00
|
|
|
'styles/fonts.css',
|
2013-01-30 23:11:34 +01:00
|
|
|
),
|
|
|
|
'output_filename': 'min/app.css'
|
|
|
|
},
|
2013-05-28 21:46:16 +02:00
|
|
|
'common': {
|
2013-04-06 00:19:32 +02:00
|
|
|
'source_filenames': (
|
|
|
|
'third/bootstrap/css/bootstrap.css',
|
2014-03-05 20:39:57 +01:00
|
|
|
'third/bootstrap/css/bootstrap-btn.css',
|
2013-04-06 00:19:32 +02:00
|
|
|
'third/bootstrap/css/bootstrap-responsive.css',
|
|
|
|
),
|
2013-05-28 21:46:16 +02:00
|
|
|
'output_filename': 'min/common.css'
|
2013-04-06 00:19:32 +02:00
|
|
|
},
|
2013-01-30 23:11:34 +01:00
|
|
|
}
|
|
|
|
|
Reuse minified JS from previous deploys
This is a big change affecting lots of areas:
* Pipeline no longer deals with JS (though it still minifies CSS)
* A new script, tools/minify-js (called from update-prod-static),
minifies JavaScripts
* A command-line argument --prev-deploy, if passed to minify-js or
update-prod-static, is used to copy minified JS from a previous
deploy (i.e., a previous git checkout), if the source files have
not changed
* update-deployment passes --prev-deploy
* Scripts are now included with the minified_js template tag, rather
than Pipeline's compressed_js
Also, as a side benefit of this commit, our Handlebars templates will
no longer be copied into prod-static/ and accessible in production.
Unminification is probably broken, but, per Zev and Trac ticket #1377,
it wasn't working perfectly before this change either.
(Based on code review, this commit has been revised to:
* Warn if git returns an error in minify-js
* Add missing output redirects in update-prod-static
* Use DEPLOY_ROOT instead of manually constructing that directory
* Use old style formatting)
(imported from commit e67722ea252756db8519d5c0bd6a421d59374185)
2013-07-03 22:42:25 +02:00
|
|
|
JS_SPECS = {
|
2013-02-25 02:59:59 +01:00
|
|
|
'common': {
|
2013-05-28 21:46:16 +02:00
|
|
|
'source_filenames': (
|
|
|
|
'third/jquery/jquery-1.7.2.js',
|
2013-10-22 20:34:16 +02:00
|
|
|
'third/underscore/underscore.js',
|
2013-05-28 21:46:16 +02:00
|
|
|
'js/blueslip.js',
|
|
|
|
'third/bootstrap/js/bootstrap.js',
|
|
|
|
'js/common.js',
|
|
|
|
),
|
2013-02-25 02:59:59 +01:00
|
|
|
'output_filename': 'min/common.js'
|
|
|
|
},
|
2013-05-17 21:45:37 +02:00
|
|
|
'landing-page': {
|
2013-05-28 21:46:16 +02:00
|
|
|
'source_filenames': (
|
|
|
|
'third/jquery-form/jquery.form.js',
|
|
|
|
'js/landing-page.js',
|
|
|
|
),
|
2013-05-17 21:45:37 +02:00
|
|
|
'output_filename': 'min/landing-page.js'
|
|
|
|
},
|
2013-02-25 02:59:59 +01:00
|
|
|
'signup': {
|
2013-05-28 21:46:16 +02:00
|
|
|
'source_filenames': (
|
|
|
|
'js/signup.js',
|
|
|
|
'third/jquery-validate/jquery.validate.js',
|
|
|
|
),
|
2013-02-25 02:59:59 +01:00
|
|
|
'output_filename': 'min/signup.js'
|
|
|
|
},
|
2013-07-11 21:40:52 +02:00
|
|
|
'initial_invite': {
|
|
|
|
'source_filenames': (
|
|
|
|
'third/jquery-validate/jquery.validate.js',
|
|
|
|
'js/initial_invite.js',
|
|
|
|
),
|
|
|
|
'output_filename': 'min/initial_invite.js'
|
|
|
|
},
|
2013-04-09 22:20:46 +02:00
|
|
|
'api': {
|
|
|
|
'source_filenames': ('js/api.js',),
|
|
|
|
'output_filename': 'min/api.js'
|
|
|
|
},
|
2013-02-25 02:59:59 +01:00
|
|
|
'app_debug': {
|
|
|
|
'source_filenames': ('js/debug.js',),
|
|
|
|
'output_filename': 'min/app_debug.js'
|
|
|
|
},
|
2013-01-30 23:11:34 +01:00
|
|
|
'app': {
|
2013-02-16 11:17:23 +01:00
|
|
|
'source_filenames': [
|
2013-06-19 01:41:27 +02:00
|
|
|
'third/bootstrap-notify/js/bootstrap-notify.js',
|
2013-06-25 21:54:24 +02:00
|
|
|
'third/html5-formdata/formdata.js',
|
2013-05-28 21:46:16 +02:00
|
|
|
'third/jquery-validate/jquery.validate.js',
|
|
|
|
'third/jquery-form/jquery.form.js',
|
|
|
|
'third/jquery-filedrop/jquery.filedrop.js',
|
|
|
|
'third/jquery-caret/jquery.caret.1.02.js',
|
|
|
|
'third/xdate/xdate.dev.js',
|
|
|
|
'third/spin/spin.js',
|
|
|
|
'third/jquery-mousewheel/jquery.mousewheel.js',
|
|
|
|
'third/jquery-throttle-debounce/jquery.ba-throttle-debounce.js',
|
|
|
|
'third/jquery-idle/jquery.idle.js',
|
|
|
|
'third/jquery-autosize/jquery.autosize.js',
|
2014-02-27 21:58:40 +01:00
|
|
|
'third/jquery-perfect-scrollbar/js/perfect-scrollbar.js',
|
2013-08-26 18:35:25 +02:00
|
|
|
'third/lazyload/lazyload.js',
|
2013-05-28 21:46:16 +02:00
|
|
|
'third/spectrum/spectrum.js',
|
2013-08-23 20:49:06 +02:00
|
|
|
'third/winchan/winchan.js',
|
2013-09-07 00:27:10 +02:00
|
|
|
'third/sockjs/sockjs-0.3.4.js',
|
2014-01-09 23:51:32 +01:00
|
|
|
'third/handlebars/handlebars.runtime.js',
|
2013-12-13 19:58:31 +01:00
|
|
|
'third/marked/lib/marked.js',
|
2014-01-09 23:51:32 +01:00
|
|
|
'templates/compiled.js',
|
2013-08-01 17:59:23 +02:00
|
|
|
'js/feature_flags.js',
|
2014-03-13 15:03:01 +01:00
|
|
|
'js/loading.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/util.js',
|
2013-08-07 22:28:45 +02:00
|
|
|
'js/dict.js',
|
2014-01-16 16:42:30 +01:00
|
|
|
'js/localstorage.js',
|
2013-12-18 19:55:18 +01:00
|
|
|
'js/channel.js',
|
2014-03-13 15:56:46 +01:00
|
|
|
'js/setup.js',
|
2013-08-20 22:05:56 +02:00
|
|
|
'js/muting.js',
|
2013-09-10 20:07:24 +02:00
|
|
|
'js/muting_ui.js',
|
2013-05-07 17:15:20 +02:00
|
|
|
'js/viewport.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/rows.js',
|
2013-05-17 21:32:26 +02:00
|
|
|
'js/unread.js',
|
2013-05-06 02:54:15 +02:00
|
|
|
'js/stream_list.js',
|
2013-08-10 01:31:31 +02:00
|
|
|
'js/filter.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/narrow.js',
|
|
|
|
'js/reload.js',
|
2013-01-30 21:49:56 +01:00
|
|
|
'js/notifications_bar.js',
|
2013-08-11 21:21:47 +02:00
|
|
|
'js/compose_fade.js',
|
2014-01-27 23:20:50 +01:00
|
|
|
'js/fenced_code.js',
|
2013-12-04 17:16:08 +01:00
|
|
|
'js/echo.js',
|
2013-09-10 20:39:46 +02:00
|
|
|
'js/socket.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/compose.js',
|
2013-08-07 19:28:06 +02:00
|
|
|
'js/stream_color.js',
|
2013-08-12 23:31:23 +02:00
|
|
|
'js/admin.js',
|
2013-08-15 21:11:07 +02:00
|
|
|
'js/stream_data.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/subs.js',
|
2013-05-15 00:22:16 +02:00
|
|
|
'js/message_edit.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/ui.js',
|
2013-06-28 22:38:40 +02:00
|
|
|
'js/popovers.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/typeahead_helper.js',
|
2013-07-30 23:02:10 +02:00
|
|
|
'js/search_suggestion.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/search.js',
|
|
|
|
'js/composebox_typeahead.js',
|
2013-07-24 22:51:13 +02:00
|
|
|
'js/navigate.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/hotkey.js',
|
2014-03-13 17:44:43 +01:00
|
|
|
'js/favicon.js',
|
2013-01-30 23:11:34 +01:00
|
|
|
'js/notifications.js',
|
|
|
|
'js/hashchange.js',
|
|
|
|
'js/invite.js',
|
2013-08-16 17:10:22 +02:00
|
|
|
'js/message_list_view.js',
|
2012-12-05 23:54:49 +01:00
|
|
|
'js/message_list.js',
|
2014-01-31 17:03:52 +01:00
|
|
|
'js/message_flags.js',
|
2013-09-20 20:26:53 +02:00
|
|
|
'js/alert_words.js',
|
|
|
|
'js/alert_words_ui.js',
|
2014-01-30 22:42:19 +01:00
|
|
|
'js/people.js',
|
2014-01-31 16:27:24 +01:00
|
|
|
'js/message_store.js',
|
2014-01-30 19:25:25 +01:00
|
|
|
'js/server_events.js',
|
2013-07-29 22:48:16 +02:00
|
|
|
'js/zulip.js',
|
2013-02-07 19:57:45 +01:00
|
|
|
'js/activity.js',
|
2013-02-16 09:43:27 +01:00
|
|
|
'js/colorspace.js',
|
2013-01-14 17:26:50 +01:00
|
|
|
'js/timerender.js',
|
2013-02-13 22:04:35 +01:00
|
|
|
'js/tutorial.js',
|
2013-02-16 10:45:32 +01:00
|
|
|
'js/templates.js',
|
2013-07-29 17:29:25 +02:00
|
|
|
'js/avatar.js',
|
2013-05-09 21:12:53 +02:00
|
|
|
'js/settings.js',
|
|
|
|
'js/tab_bar.js',
|
2013-07-26 16:51:02 +02:00
|
|
|
'js/emoji.js',
|
2014-01-17 20:18:53 +01:00
|
|
|
'js/referral.js',
|
|
|
|
'js/custom_markdown.js',
|
2014-02-27 00:01:18 +01:00
|
|
|
'js/bot_data.js',
|
2013-02-16 11:17:23 +01:00
|
|
|
],
|
2013-01-30 23:11:34 +01:00
|
|
|
'output_filename': 'min/app.js'
|
|
|
|
},
|
2013-05-28 21:46:16 +02:00
|
|
|
'activity': {
|
2013-04-06 00:19:32 +02:00
|
|
|
'source_filenames': (
|
|
|
|
'third/sorttable/sorttable.js',
|
|
|
|
),
|
2013-05-28 21:46:16 +02:00
|
|
|
'output_filename': 'min/activity.js'
|
2013-04-06 00:19:32 +02:00
|
|
|
},
|
2013-09-07 00:27:10 +02:00
|
|
|
# We also want to minify sockjs separately for the sockjs iframe transport
|
|
|
|
'sockjs': {
|
|
|
|
'source_filenames': ('third/sockjs/sockjs-0.3.4.js',),
|
|
|
|
'output_filename': 'min/sockjs-0.3.4.min.js'
|
|
|
|
},
|
2013-01-30 23:11:34 +01:00
|
|
|
}
|
|
|
|
|
2013-11-14 00:28:45 +01:00
|
|
|
app_srcs = JS_SPECS['app']['source_filenames']
|
|
|
|
|
|
|
|
if MIXPANEL_TOKEN:
|
|
|
|
# Mixpanel is not used on enterprise and throws an error when the
|
|
|
|
# library is not included
|
|
|
|
app_srcs.append('js/metrics.js')
|
2013-01-30 23:11:34 +01:00
|
|
|
|
Reuse minified JS from previous deploys
This is a big change affecting lots of areas:
* Pipeline no longer deals with JS (though it still minifies CSS)
* A new script, tools/minify-js (called from update-prod-static),
minifies JavaScripts
* A command-line argument --prev-deploy, if passed to minify-js or
update-prod-static, is used to copy minified JS from a previous
deploy (i.e., a previous git checkout), if the source files have
not changed
* update-deployment passes --prev-deploy
* Scripts are now included with the minified_js template tag, rather
than Pipeline's compressed_js
Also, as a side benefit of this commit, our Handlebars templates will
no longer be copied into prod-static/ and accessible in production.
Unminification is probably broken, but, per Zev and Trac ticket #1377,
it wasn't working perfectly before this change either.
(Based on code review, this commit has been revised to:
* Warn if git returns an error in minify-js
* Add missing output redirects in update-prod-static
* Use DEPLOY_ROOT instead of manually constructing that directory
* Use old style formatting)
(imported from commit e67722ea252756db8519d5c0bd6a421d59374185)
2013-07-03 22:42:25 +02:00
|
|
|
PIPELINE_JS = {} # Now handled in tools/minify-js
|
|
|
|
PIPELINE_JS_COMPRESSOR = None
|
2013-03-27 17:59:24 +01:00
|
|
|
|
Reuse minified JS from previous deploys
This is a big change affecting lots of areas:
* Pipeline no longer deals with JS (though it still minifies CSS)
* A new script, tools/minify-js (called from update-prod-static),
minifies JavaScripts
* A command-line argument --prev-deploy, if passed to minify-js or
update-prod-static, is used to copy minified JS from a previous
deploy (i.e., a previous git checkout), if the source files have
not changed
* update-deployment passes --prev-deploy
* Scripts are now included with the minified_js template tag, rather
than Pipeline's compressed_js
Also, as a side benefit of this commit, our Handlebars templates will
no longer be copied into prod-static/ and accessible in production.
Unminification is probably broken, but, per Zev and Trac ticket #1377,
it wasn't working perfectly before this change either.
(Based on code review, this commit has been revised to:
* Warn if git returns an error in minify-js
* Add missing output redirects in update-prod-static
* Use DEPLOY_ROOT instead of manually constructing that directory
* Use old style formatting)
(imported from commit e67722ea252756db8519d5c0bd6a421d59374185)
2013-07-03 22:42:25 +02:00
|
|
|
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yui.YUICompressor'
|
|
|
|
PIPELINE_YUI_BINARY = '/usr/bin/env yui-compressor'
|
2013-01-30 23:11:34 +01:00
|
|
|
|
2014-01-14 17:49:21 +01:00
|
|
|
USING_RABBITMQ = True
|
2013-10-24 19:22:34 +02:00
|
|
|
RABBITMQ_USERNAME = 'zulip'
|
2013-07-02 23:29:00 +02:00
|
|
|
|
|
|
|
SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
|
|
|
|
|
|
|
|
CACHES = {
|
|
|
|
'default': {
|
|
|
|
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
|
|
|
|
'LOCATION': '127.0.0.1:11211',
|
|
|
|
'TIMEOUT': 3600
|
|
|
|
},
|
|
|
|
'database': {
|
|
|
|
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
|
|
|
|
'LOCATION': 'third_party_api_results',
|
|
|
|
# Basically never timeout. Setting to 0 isn't guaranteed
|
|
|
|
# to work, see https://code.djangoproject.com/ticket/9595
|
|
|
|
'TIMEOUT': 2000000000,
|
2012-09-19 17:58:22 +02:00
|
|
|
'OPTIONS': {
|
2013-07-02 23:29:00 +02:00
|
|
|
'MAX_ENTRIES': 100000000,
|
|
|
|
'CULL_FREQUENCY': 10,
|
2013-03-11 19:01:21 +01:00
|
|
|
}
|
2013-07-02 23:29:00 +02:00
|
|
|
},
|
|
|
|
}
|
2012-09-19 17:58:22 +02:00
|
|
|
|
2013-11-26 00:01:14 +01:00
|
|
|
ZULIP_PATHS = [
|
|
|
|
("SERVER_LOG_PATH", "/var/log/zulip/server.log"),
|
2013-12-16 21:44:50 +01:00
|
|
|
("ERROR_FILE_LOG_PATH", "/var/log/zulip/errors.log"),
|
2013-11-26 00:01:14 +01:00
|
|
|
("MANAGEMENT_LOG_PATH", "/var/log/zulip/manage.log"),
|
|
|
|
("WORKER_LOG_PATH", "/var/log/zulip/workers.log"),
|
|
|
|
("PERSISTENT_QUEUE_FILENAME", "/home/zulip/tornado/event_queues.pickle"),
|
|
|
|
("JSON_PERSISTENT_QUEUE_FILENAME", "/home/zulip/tornado/event_queues.json"),
|
|
|
|
("EMAIL_MIRROR_LOG_PATH", "/var/log/zulip/email-mirror.log"),
|
|
|
|
("EMAIL_DELIVERER_LOG_PATH", "/var/log/zulip/email-deliverer.log"),
|
|
|
|
("LDAP_SYNC_LOG_PATH", "/var/log/zulip/sync_ldap_user_data.log"),
|
|
|
|
("QUEUE_ERROR_DIR", "/var/log/zulip/queue_error"),
|
|
|
|
("STATS_DIR", "/home/zulip/stats"),
|
2013-12-16 23:03:09 +01:00
|
|
|
("DIGEST_LOG_PATH", "/var/log/zulip/digest.log"),
|
2013-11-26 00:01:14 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
if ENTERPRISE:
|
|
|
|
EVENT_LOG_DIR = None
|
2013-04-09 22:01:38 +02:00
|
|
|
else:
|
2013-11-26 00:01:14 +01:00
|
|
|
ZULIP_PATHS.append(("EVENT_LOG_DIR", "/home/zulip/logs/event_log"))
|
2013-10-29 20:03:42 +01:00
|
|
|
|
2013-11-26 00:01:14 +01:00
|
|
|
for (var, path) in ZULIP_PATHS:
|
|
|
|
if not DEPLOYED:
|
|
|
|
# if not DEPLOYED, store these files in the Zulip checkout
|
|
|
|
path = os.path.basename(path)
|
|
|
|
vars()[var] = path
|
2013-04-09 22:01:38 +02:00
|
|
|
|
2013-10-30 16:01:18 +01:00
|
|
|
ZULIP_WORKER_TEST_FILE = '/tmp/zulip-worker-test-file'
|
|
|
|
|
|
|
|
|
2014-01-07 22:27:52 +01:00
|
|
|
if IS_WORKER:
|
2013-09-26 23:06:01 +02:00
|
|
|
FILE_LOG_PATH = WORKER_LOG_PATH
|
|
|
|
else:
|
|
|
|
FILE_LOG_PATH = SERVER_LOG_PATH
|
|
|
|
|
2012-08-28 18:44:51 +02:00
|
|
|
LOGGING = {
|
|
|
|
'version': 1,
|
2012-10-16 22:52:51 +02:00
|
|
|
'disable_existing_loggers': True,
|
2012-09-18 22:40:19 +02:00
|
|
|
'formatters': {
|
|
|
|
'default': {
|
|
|
|
'format': '%(asctime)s %(levelname)-8s %(message)s'
|
|
|
|
}
|
|
|
|
},
|
2012-12-05 18:01:43 +01:00
|
|
|
'filters': {
|
2013-08-06 21:37:34 +02:00
|
|
|
'ZulipLimiter': {
|
|
|
|
'()': 'zerver.lib.logging_util.ZulipLimiter',
|
2012-12-06 22:00:34 +01:00
|
|
|
},
|
|
|
|
'EmailLimiter': {
|
2013-07-29 23:03:31 +02:00
|
|
|
'()': 'zerver.lib.logging_util.EmailLimiter',
|
2012-12-06 22:00:34 +01:00
|
|
|
},
|
|
|
|
'require_debug_false': {
|
|
|
|
'()': 'django.utils.log.RequireDebugFalse',
|
2013-03-15 17:03:56 +01:00
|
|
|
},
|
|
|
|
'nop': {
|
2013-07-29 23:03:31 +02:00
|
|
|
'()': 'zerver.lib.logging_util.ReturnTrue',
|
2013-03-15 17:03:56 +01:00
|
|
|
},
|
2013-06-10 18:59:10 +02:00
|
|
|
'require_really_deployed': {
|
2013-07-29 23:03:31 +02:00
|
|
|
'()': 'zerver.lib.logging_util.RequireReallyDeployed',
|
2013-06-10 18:59:10 +02:00
|
|
|
},
|
2012-12-05 18:01:43 +01:00
|
|
|
},
|
2012-09-18 22:40:19 +02:00
|
|
|
'handlers': {
|
2013-08-06 22:30:41 +02:00
|
|
|
'zulip_admins': {
|
2012-12-06 22:00:34 +01:00
|
|
|
'level': 'ERROR',
|
2013-08-06 21:35:33 +02:00
|
|
|
'class': 'zerver.handlers.AdminZulipHandler',
|
2013-03-15 17:03:56 +01:00
|
|
|
# For testing the handler delete the next line
|
2013-08-06 21:37:34 +02:00
|
|
|
'filters': ['ZulipLimiter', 'require_debug_false', 'require_really_deployed'],
|
2012-12-06 22:00:34 +01:00
|
|
|
'formatter': 'default'
|
|
|
|
},
|
2012-09-18 22:40:19 +02:00
|
|
|
'console': {
|
|
|
|
'level': 'DEBUG',
|
|
|
|
'class': 'logging.StreamHandler',
|
|
|
|
'formatter': 'default'
|
2012-10-12 23:47:43 +02:00
|
|
|
},
|
|
|
|
'file': {
|
2013-04-09 22:01:38 +02:00
|
|
|
'level': 'DEBUG',
|
|
|
|
'class': 'logging.handlers.TimedRotatingFileHandler',
|
|
|
|
'formatter': 'default',
|
2013-09-26 23:06:01 +02:00
|
|
|
'filename': FILE_LOG_PATH,
|
2013-04-09 22:01:38 +02:00
|
|
|
'when': 'D',
|
|
|
|
'interval': 7,
|
|
|
|
'backupCount': 100000000,
|
2012-12-05 18:01:43 +01:00
|
|
|
},
|
2013-12-16 21:44:50 +01:00
|
|
|
'errors_file': {
|
|
|
|
'level': 'WARNING',
|
|
|
|
'class': 'logging.handlers.TimedRotatingFileHandler',
|
|
|
|
'formatter': 'default',
|
|
|
|
'filename': ERROR_FILE_LOG_PATH,
|
|
|
|
'when': 'D',
|
|
|
|
'interval': 7,
|
|
|
|
'backupCount': 100000000,
|
|
|
|
},
|
2012-09-18 22:40:19 +02:00
|
|
|
},
|
|
|
|
'loggers': {
|
2012-10-09 17:41:13 +02:00
|
|
|
'': {
|
2013-12-16 21:44:50 +01:00
|
|
|
'handlers': ['console', 'file', 'errors_file'],
|
2013-03-27 22:07:45 +01:00
|
|
|
'level': 'INFO',
|
|
|
|
'propagate': False,
|
|
|
|
},
|
|
|
|
'django': {
|
2013-11-13 21:35:04 +01:00
|
|
|
'handlers': (['zulip_admins'] if ERROR_REPORTING else [])
|
2013-12-16 21:44:50 +01:00
|
|
|
+ ['console', 'file', 'errors_file'],
|
2013-03-27 22:07:45 +01:00
|
|
|
'level': 'INFO',
|
|
|
|
'propagate': False,
|
|
|
|
},
|
2013-08-06 22:51:47 +02:00
|
|
|
'zulip.requests': {
|
2013-12-16 21:44:50 +01:00
|
|
|
'handlers': ['console', 'file', 'errors_file'],
|
2013-03-27 22:07:45 +01:00
|
|
|
'level': 'INFO',
|
|
|
|
'propagate': False,
|
2013-03-15 18:13:03 +01:00
|
|
|
},
|
2013-11-19 00:04:45 +01:00
|
|
|
'zulip.management': {
|
2013-12-16 21:44:50 +01:00
|
|
|
'handlers': ['file', 'errors_file'],
|
2013-11-19 00:04:45 +01:00
|
|
|
'level': 'INFO',
|
|
|
|
'propagate': False,
|
|
|
|
},
|
2013-03-15 18:13:03 +01:00
|
|
|
## Uncomment the following to get all database queries logged to the console
|
|
|
|
# 'django.db': {
|
|
|
|
# 'handlers': ['console'],
|
|
|
|
# 'level': 'DEBUG',
|
2013-03-27 22:07:45 +01:00
|
|
|
# 'propagate': False,
|
2013-03-15 18:13:03 +01:00
|
|
|
# },
|
2012-09-18 22:40:19 +02:00
|
|
|
}
|
2012-08-28 18:44:51 +02:00
|
|
|
}
|
|
|
|
|
2012-10-15 22:52:08 +02:00
|
|
|
TEMPLATE_CONTEXT_PROCESSORS = (
|
2013-07-29 23:03:31 +02:00
|
|
|
'zerver.context_processors.add_settings',
|
|
|
|
'zerver.context_processors.add_metrics',
|
2012-10-15 22:52:08 +02:00
|
|
|
)
|
|
|
|
|
2012-08-28 18:44:51 +02:00
|
|
|
ACCOUNT_ACTIVATION_DAYS=7
|
2012-10-01 21:03:59 +02:00
|
|
|
|
2012-09-06 21:15:11 +02:00
|
|
|
LOGIN_REDIRECT_URL='/'
|
2013-02-20 22:26:06 +01:00
|
|
|
OPENID_SSO_SERVER_URL = 'https://www.google.com/accounts/o8/id'
|
|
|
|
OPENID_CREATE_USERS = True
|
|
|
|
OPENID_RENDER_FAILURE = openid_failure_handler
|
2012-09-27 19:58:42 +02:00
|
|
|
|
2013-03-28 22:38:45 +01:00
|
|
|
# Client-side polling timeout for get_events, in milliseconds.
|
2012-12-11 18:08:18 +01:00
|
|
|
# We configure this here so that the client test suite can override it.
|
2013-03-28 22:38:45 +01:00
|
|
|
# We already kill the connection server-side with heartbeat events,
|
|
|
|
# but it's good to have a safety. This value should be greater than
|
|
|
|
# (HEARTBEAT_MIN_FREQ_SECS + 10)
|
|
|
|
POLL_TIMEOUT = 90 * 1000
|
2012-12-11 18:08:18 +01:00
|
|
|
|
2013-03-18 18:40:47 +01:00
|
|
|
# The new user tutorial is enabled by default, and disabled for
|
|
|
|
# client tests.
|
|
|
|
TUTORIAL_ENABLED = True
|
|
|
|
|
2013-11-13 22:35:14 +01:00
|
|
|
USING_SSO = ('zproject.backends.ZulipRemoteUserBackend' in AUTHENTICATION_BACKENDS)
|
|
|
|
|
2013-11-13 17:21:41 +01:00
|
|
|
if (len(AUTHENTICATION_BACKENDS) == 1 and
|
|
|
|
AUTHENTICATION_BACKENDS[0] == "zproject.backends.ZulipRemoteUserBackend"):
|
|
|
|
HOME_NOT_LOGGED_IN = "/accounts/login/sso"
|
2013-11-13 23:11:59 +01:00
|
|
|
ONLY_SSO = True
|
2013-11-13 17:21:41 +01:00
|
|
|
else:
|
|
|
|
HOME_NOT_LOGGED_IN = '/login'
|
2013-11-14 14:15:23 +01:00
|
|
|
ONLY_SSO = False
|
2013-11-13 17:21:41 +01:00
|
|
|
AUTHENTICATION_BACKENDS += ('guardian.backends.ObjectPermissionBackend',)
|
2013-11-21 04:57:23 +01:00
|
|
|
AUTHENTICATION_BACKENDS += ('zproject.backends.ZulipDummyBackend',)
|
2013-11-13 17:21:41 +01:00
|
|
|
|
2013-11-26 00:44:37 +01:00
|
|
|
POPULATE_PROFILE_VIA_LDAP = bool(AUTH_LDAP_SERVER_URI)
|
2013-11-21 01:30:20 +01:00
|
|
|
|
|
|
|
if POPULATE_PROFILE_VIA_LDAP and \
|
|
|
|
not 'zproject.backends.ZulipLDAPAuthBackend' in AUTHENTICATION_BACKENDS:
|
|
|
|
AUTHENTICATION_BACKENDS += ('zproject.backends.ZulipLDAPUserPopulator',)
|
|
|
|
else:
|
|
|
|
POPULATE_PROFILE_VIA_LDAP = 'zproject.backends.ZulipLDAPAuthBackend' in AUTHENTICATION_BACKENDS or POPULATE_PROFILE_VIA_LDAP
|
|
|
|
|
2012-12-11 22:07:57 +01:00
|
|
|
if DEPLOYED:
|
2012-10-15 22:52:08 +02:00
|
|
|
FULL_NAVBAR = False
|
2012-10-15 22:34:24 +02:00
|
|
|
else:
|
2012-10-15 22:52:08 +02:00
|
|
|
FULL_NAVBAR = True
|
2012-10-15 22:31:06 +02:00
|
|
|
|
2013-11-05 01:19:52 +01:00
|
|
|
# If an email host is not specified, fail silently and gracefully
|
|
|
|
if not EMAIL_HOST and DEPLOYED:
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
|
|
|
|
elif not DEPLOYED:
|
2012-10-01 21:03:59 +02:00
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
2013-11-05 01:19:52 +01:00
|
|
|
else:
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
2012-10-20 21:25:33 +02:00
|
|
|
|
2013-11-05 01:19:52 +01:00
|
|
|
# For testing, you may want to have emails be printed to the console.
|
|
|
|
if not DEPLOYED:
|
2012-10-20 21:25:33 +02:00
|
|
|
# Use fast password hashing for creating testing users when not
|
2012-12-11 22:07:57 +01:00
|
|
|
# DEPLOYED
|
2012-10-20 21:25:33 +02:00
|
|
|
PASSWORD_HASHERS = (
|
|
|
|
'django.contrib.auth.hashers.SHA1PasswordHasher',
|
2013-01-03 21:43:45 +01:00
|
|
|
'django.contrib.auth.hashers.PBKDF2PasswordHasher'
|
2012-10-20 21:25:33 +02:00
|
|
|
)
|
2012-12-07 23:00:13 +01:00
|
|
|
|
2012-12-11 22:07:57 +01:00
|
|
|
if DEPLOYED:
|
2012-12-07 23:00:13 +01:00
|
|
|
# Filter out user data
|
2013-08-06 21:38:05 +02:00
|
|
|
DEFAULT_EXCEPTION_REPORTER_FILTER = 'zerver.filters.ZulipExceptionReporterFilter'
|
2013-03-14 22:12:25 +01:00
|
|
|
|
|
|
|
# We want all temporary uploaded files to be stored on disk.
|
|
|
|
|
|
|
|
FILE_UPLOAD_MAX_MEMORY_SIZE = 0
|
|
|
|
|
2013-06-21 16:52:46 +02:00
|
|
|
# We are not currently using embedly due to some performance issues, but
|
|
|
|
# we are keeping the code on master for now, behind this launch flag.
|
|
|
|
# If you turn this back on for dev, you will want it to be still False
|
|
|
|
# for running the tests, or you will need to ensure that embedly_client.is_supported()
|
|
|
|
# gets called before the tests run.
|
|
|
|
USING_EMBEDLY = False
|
2013-11-18 18:55:19 +01:00
|
|
|
|
|
|
|
# This is a debugging option only
|
|
|
|
PROFILE_ALL_REQUESTS = False
|