thumbor: Fix exceptions if LOCAL_UPLOADS_DIR is not set.

This is the typical configuration in /etc/zulip/settings.py for a site
using S3, since there's no obligation to set the setting to None
directly, and we're not importing the main `settings.py` (and thus not
getting DEFAULT_SETTINGS applied).
This commit is contained in:
Tim Abbott
2018-07-31 13:56:41 -07:00
parent b564976ce4
commit da56449c65

View File

@@ -19,7 +19,10 @@ config_file.read("/etc/zulip/zulip.conf")
# Whether this instance of Zulip is running in a production environment.
PRODUCTION = config_file.has_option('machine', 'deploy_type')
if PRODUCTION:
try:
from zproject.prod_settings import LOCAL_UPLOADS_DIR
except ImportError:
LOCAL_UPLOADS_DIR = None
else:
from zproject.dev_settings import LOCAL_UPLOADS_DIR