mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
Add settings.DEVELOPMENT as a complement of settings.DEPLOYED.
(imported from commit 0437140d9fee7eec7b28abe583cfe8cde3e07c21)
This commit is contained in:
@@ -4,7 +4,7 @@ from django.conf import settings
|
|||||||
MAIL_CLIENT = None
|
MAIL_CLIENT = None
|
||||||
|
|
||||||
def get_mandrill_client():
|
def get_mandrill_client():
|
||||||
if settings.MANDRILL_API_KEY == '' or not settings.DEPLOYED or settings.ENTERPRISE:
|
if settings.MANDRILL_API_KEY == '' or settings.DEVELOPMENT or settings.ENTERPRISE:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
global MAIL_CLIENT
|
global MAIL_CLIENT
|
||||||
|
|||||||
@@ -400,8 +400,8 @@ def send_future_email(recipients, email_html, email_text, subject,
|
|||||||
"""
|
"""
|
||||||
# When sending real emails while testing locally, don't accidentally send
|
# When sending real emails while testing locally, don't accidentally send
|
||||||
# emails to non-zulip.com users.
|
# emails to non-zulip.com users.
|
||||||
if not settings.DEPLOYED and \
|
if settings.DEVELOPMENT and \
|
||||||
settings.EMAIL_BACKEND != 'django.core.mail.backends.console.EmailBackend':
|
settings.EMAIL_BACKEND != 'django.core.mail.backends.console.EmailBackend':
|
||||||
for recipient in recipients:
|
for recipient in recipients:
|
||||||
email = recipient.get("email")
|
email = recipient.get("email")
|
||||||
if get_user_profile_by_email(email).realm.domain != "zulip.com":
|
if get_user_profile_by_email(email).realm.domain != "zulip.com":
|
||||||
|
|||||||
@@ -1017,7 +1017,7 @@ def home(request):
|
|||||||
max_message_id = register_ret['max_message_id'],
|
max_message_id = register_ret['max_message_id'],
|
||||||
unread_count = approximate_unread_count(user_profile),
|
unread_count = approximate_unread_count(user_profile),
|
||||||
furthest_read_time = sent_time_in_epoch_seconds(latest_read),
|
furthest_read_time = sent_time_in_epoch_seconds(latest_read),
|
||||||
staging = settings.STAGING_DEPLOYED or not settings.DEPLOYED,
|
staging = settings.STAGING_DEPLOYED or settings.DEVELOPMENT,
|
||||||
alert_words = register_ret['alert_words'],
|
alert_words = register_ret['alert_words'],
|
||||||
muted_topics = register_ret['muted_topics'],
|
muted_topics = register_ret['muted_topics'],
|
||||||
realm_filters = register_ret['realm_filters'],
|
realm_filters = register_ret['realm_filters'],
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ config_file.read("/etc/zulip/zulip.conf")
|
|||||||
|
|
||||||
# Whether this instance of Zulip is running in a production environment.
|
# Whether this instance of Zulip is running in a production environment.
|
||||||
DEPLOYED = config_file.has_option('machine', 'deploy_type')
|
DEPLOYED = config_file.has_option('machine', 'deploy_type')
|
||||||
|
DEVELOPMENT = not DEPLOYED
|
||||||
# The following flags are leftover from the various configurations of
|
# The following flags are leftover from the various configurations of
|
||||||
# Zulip run by Zulip, Inc. We will eventually be able to get rid of
|
# Zulip run by Zulip, Inc. We will eventually be able to get rid of
|
||||||
# them and just have the DEPLOYED flag, but we need them for now.
|
# them and just have the DEPLOYED flag, but we need them for now.
|
||||||
@@ -59,7 +60,7 @@ SERVER_GENERATION = int(time.time())
|
|||||||
|
|
||||||
if not 'DEBUG' in globals():
|
if not 'DEBUG' in globals():
|
||||||
# Uncomment end of next line to test JS/CSS minification.
|
# Uncomment end of next line to test JS/CSS minification.
|
||||||
DEBUG = not DEPLOYED # and platform.node() != 'your-machine'
|
DEBUG = DEVELOPMENT # and platform.node() != 'your-machine'
|
||||||
|
|
||||||
TEMPLATE_DEBUG = DEBUG
|
TEMPLATE_DEBUG = DEBUG
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ urlpatterns = patterns('',
|
|||||||
|
|
||||||
# These are used for enterprise development. On a real enterprise instance,
|
# These are used for enterprise development. On a real enterprise instance,
|
||||||
# these files would be served by nginx.
|
# these files would be served by nginx.
|
||||||
if not settings.DEPLOYED and settings.LOCAL_UPLOADS_DIR is not None:
|
if settings.DEVELOPMENT and settings.LOCAL_UPLOADS_DIR is not None:
|
||||||
urlpatterns += patterns('',
|
urlpatterns += patterns('',
|
||||||
url(r'^user_avatars/(?P<path>.*)$', 'django.views.static.serve',
|
url(r'^user_avatars/(?P<path>.*)$', 'django.views.static.serve',
|
||||||
{'document_root': os.path.join(settings.LOCAL_UPLOADS_DIR, "avatars")}),
|
{'document_root': os.path.join(settings.LOCAL_UPLOADS_DIR, "avatars")}),
|
||||||
@@ -287,7 +287,7 @@ urlpatterns += patterns('',
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if not settings.DEPLOYED:
|
if settings.DEVELOPMENT:
|
||||||
use_prod_static = getattr(settings, 'PIPELINE', False)
|
use_prod_static = getattr(settings, 'PIPELINE', False)
|
||||||
static_root = os.path.join(settings.DEPLOY_ROOT,
|
static_root = os.path.join(settings.DEPLOY_ROOT,
|
||||||
'prod-static/serve' if use_prod_static else 'static')
|
'prod-static/serve' if use_prod_static else 'static')
|
||||||
|
|||||||
Reference in New Issue
Block a user