From af0f8fcac63fb52f6def211b2ca16d5e5cff7e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 30 Jan 2016 10:18:08 +0100 Subject: [PATCH] Refactored logic in autoupdate.py concerning wsgi network connection variables. Fixed #1929." --- openslides/utils/autoupdate.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/openslides/utils/autoupdate.py b/openslides/utils/autoupdate.py index a40fa9927..04dbb1f8b 100644 --- a/openslides/utils/autoupdate.py +++ b/openslides/utils/autoupdate.py @@ -97,15 +97,14 @@ class OpenSlidesSockJSConnection(SockJSConnection): object_url. """ # Join network location with object URL. - if RUNNING_HOST == '0.0.0.0': - # Windows can not connect to 0.0.0.0. So connect to localhost instead - local_host = 'localhost' + if settings.OPENSLIDES_WSGI_NETWORK_LOCATION: + wsgi_network_location = settings.OPENSLIDES_WSGI_NETWORK_LOCATION else: - local_host = RUNNING_HOST - - wsgi_network_location = ( - settings.OPENSLIDES_WSGI_NETWORK_LOCATION or - 'http://{}:{}'.format(local_host, RUNNING_PORT)) + if RUNNING_HOST == '0.0.0.0': + # Windows can not connect to 0.0.0.0, so connect to localhost instead. + wsgi_network_location = 'http://localhost:{}'.format(RUNNING_PORT) + else: + wsgi_network_location = 'http://{}:{}'.format(RUNNING_HOST, RUNNING_PORT) url = ''.join((wsgi_network_location, object_url)) # Send out internal HTTP request to get data from the REST api.