sendfile: Clean up sendfile settings code.

This commit is contained in:
Tim Abbott 2018-02-15 14:59:55 -08:00 committed by Aditya Bansal
parent efe8545303
commit b3d37b5412
2 changed files with 7 additions and 4 deletions

View File

@ -78,4 +78,3 @@ TWO_FACTOR_SMS_GATEWAY = 'two_factor.gateways.fake.Fake'
# Make sendfile use django to serve files in development
SENDFILE_BACKEND = 'sendfile.backends.development'
SENDFILE_ROOT = os.path.join(LOCAL_UPLOADS_DIR, 'files')

View File

@ -180,9 +180,7 @@ DEFAULT_SETTINGS = {
'REMOTE_POSTGRES_HOST': '',
'REMOTE_POSTGRES_SSLMODE': '',
'THUMBOR_HOST': '',
'SENDFILE_BACKEND': 'sendfile.backends.nginx',
'SENDFILE_ROOT': '/home/zulip/uploads/files',
'SENDFILE_URL': '/serve_uploads',
'SENDFILE_BACKEND': None,
# ToS/Privacy templates
'PRIVACY_POLICY': None,
@ -673,6 +671,12 @@ if "NAGIOS_BOT_HOST" not in vars():
S3_KEY = get_secret("s3_key")
S3_SECRET_KEY = get_secret("s3_secret_key")
if LOCAL_UPLOADS_DIR is not None:
if SENDFILE_BACKEND is None:
SENDFILE_BACKEND = 'sendfile.backends.nginx'
SENDFILE_ROOT = os.path.join(LOCAL_UPLOADS_DIR, "files")
SENDFILE_URL = '/serve_uploads'
# GCM tokens are IP-whitelisted; if we deploy to additional
# servers you will need to explicitly add their IPs here:
# https://cloud.google.com/console/project/apps~zulip-android/apiui/credential