Skip to content

Commit

Permalink
Log if SSE is enabled/disabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
teleyinex committed Sep 29, 2015
1 parent 1c56b2b commit eee4bba
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pybossa/core.py
Expand Up @@ -63,6 +63,7 @@ def create_app(run_as_server=True):
setup_debug_toolbar(app)
setup_jinja2_filters(app)
setup_newsletter(app)
setup_sse(app)
plugin_manager.init_app(app)
plugin_manager.install_plugins()
import pybossa.model.event_listeners
Expand Down Expand Up @@ -90,6 +91,15 @@ def configure_app(app):
dict(slave=app.config.get('SQLALCHEMY_DATABASE_URI'))


def setup_sse(app):
if app.config['SSE']:
msg = "WARNING: async mode is required as Server Sent Events are enabled."
app.logger.warning(msg)
else:
msg = "INFO: async mode is disabled."
app.logger.info(msg)


def setup_theme(app):
"""Configure theme for PyBossa app."""
theme = app.config['THEME']
Expand Down
3 changes: 3 additions & 0 deletions pybossa/default_settings.py
Expand Up @@ -111,3 +111,6 @@

# Send emails weekly update every
WEEKLY_UPDATE_STATS = 'Sunday'

# Enable Server Sent Events
SSE = False
6 changes: 6 additions & 0 deletions settings_local.py.tmpl
Expand Up @@ -160,3 +160,9 @@ ACCOUNT_CONFIRMATION_DISABLED = True

# Send emails weekly update every
# WEEKLY_UPDATE_STATS = 'Sunday'

# Enable Server Sent Events
# WARNING: this will require to run PyBossa in async mode. Check the docs.
# WARNING: if you don't enable async when serving PyBossa, the server will lock
# WARNING: and it will not work. For this reason, it's disabled by default.
# SSE = False

0 comments on commit eee4bba

Please sign in to comment.