diff --git a/CHANGELOG b/CHANGELOG index 4f4d0c8a6..e4e304018 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -51,6 +51,7 @@ Other: - Used jsonfield as required package. Removed jsonfield code. - Added new package backports.ssl_match_hostname for portable build script. - Use app "django-ckeditor-updated" to render WYSIWYG HTML editors +- Only reload the webserver in debug-mode. Version 1.5.1 (2014-03-31) diff --git a/openslides/__main__.py b/openslides/__main__.py index bbf39cd15..9446265fb 100644 --- a/openslides/__main__.py +++ b/openslides/__main__.py @@ -104,10 +104,7 @@ def parse_args(): '--start-browser', action='store_true', help='Launch the default web browser and open the webinterface.') - subcommand_runserver.add_argument( - '--no-reload', - action='store_true', - help='Do not reload the webserver if source code changes.') + subcommand_runserver.set_defaults(callback=runserver) # Subcommand syncdb @@ -221,11 +218,10 @@ def start(settings, args): ensure_settings(settings, args) syncdb(settings, args) args.start_browser = not args.no_browser - args.no_reload = False - runserver(settings, args) + runserver(settings, args, block_reload=True) -def runserver(settings, args): +def runserver(settings, args, block_reload=False): """ Runs tornado webserver. Runs the function start_browser if the respective argument is given. @@ -238,7 +234,7 @@ def runserver(settings, args): # Now the settings is available and the function can be imported. from openslides.utils.tornado_webserver import run_tornado - run_tornado(args.address, port, not args.no_reload) + run_tornado(args.address, port, block_reload) def syncdb(settings, args): diff --git a/openslides/utils/tornado_webserver.py b/openslides/utils/tornado_webserver.py index a74b4d6fc..6c767d7d0 100644 --- a/openslides/utils/tornado_webserver.py +++ b/openslides/utils/tornado_webserver.py @@ -68,7 +68,7 @@ class ProjectorSocketHandler(SockJSConnection): waiter.send(data) -def run_tornado(addr, port, reload=False): +def run_tornado(addr, port, block_reload=False): # Don't try to read the command line args from openslides parse_command_line(args=[]) @@ -92,7 +92,8 @@ def run_tornado(addr, port, reload=False): ('.*', FallbackHandler, dict(fallback=app))] # Start the application - tornado_app = Application(projectpr_socket_js_router.urls + chatbox_socket_js_router.urls + other_urls, debug=reload) + debug = False if block_reload else settings.DEBUG + tornado_app = Application(projectpr_socket_js_router.urls + chatbox_socket_js_router.urls + other_urls, debug=debug) server = HTTPServer(tornado_app) server.listen(port=port, address=addr) IOLoop.instance().start() diff --git a/tests/utils/test_main.py b/tests/utils/test_main.py index 5ea30bc91..6f8ea37aa 100644 --- a/tests/utils/test_main.py +++ b/tests/utils/test_main.py @@ -117,7 +117,7 @@ class TestOtherFunctions(TestCase): mock_args = MagicMock() start(settings=None, args=mock_args) self.assertTrue(mock_syncdb.called) - mock_runserver.assert_called_with(None, mock_args) + mock_runserver.assert_called_with(None, mock_args, block_reload=True) @patch('openslides.__main__.get_port') @patch('openslides.utils.tornado_webserver.run_tornado')