From c4850e4b1993c61eec0e78a9e6a6c40d53e4a3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sun, 10 Nov 2013 22:04:35 +0100 Subject: [PATCH] Move run_tornado import into runserver function because its imports needs settings (new in Django 1.6). --- openslides/__main__.py | 4 +++- tests/utils/test_main.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openslides/__main__.py b/openslides/__main__.py index e33774676..7e6ce62a3 100644 --- a/openslides/__main__.py +++ b/openslides/__main__.py @@ -23,7 +23,6 @@ from openslides.utils.main import ( setup_django_settings_module, start_browser, write_settings) -from openslides.utils.tornado_webserver import run_tornado def main(): @@ -231,6 +230,9 @@ def runserver(settings, args): if args.start_browser: browser_url = get_browser_url(address=args.address, port=port) start_browser(browser_url) + + # 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) diff --git a/tests/utils/test_main.py b/tests/utils/test_main.py index 099f27cc7..a2e06f9f8 100644 --- a/tests/utils/test_main.py +++ b/tests/utils/test_main.py @@ -131,7 +131,7 @@ class TestOtherFunctions(TestCase): mock_runserver.assert_called_with(None, mock_args) @patch('openslides.__main__.get_port') - @patch('openslides.__main__.run_tornado') + @patch('openslides.utils.tornado_webserver.run_tornado') @patch('openslides.__main__.start_browser') def test_runserver(self, mock_start_browser, mock_run_tornado, mock_get_port): mock_get_port.return_value = 8000