diff --git a/flask_testing/utils.py b/flask_testing/utils.py index 7362c40..619090b 100644 --- a/flask_testing/utils.py +++ b/flask_testing/utils.py @@ -435,6 +435,7 @@ def __call__(self, result=None): # Get the app self.app = self.create_app() + self._configured_host = self.app.config.get('LIVESERVER_HOST', 'localhost') self._configured_port = self.app.config.get('LIVESERVER_PORT', 5000) self._port_value = multiprocessing.Value('i', self._configured_port) @@ -453,7 +454,7 @@ def get_server_url(self): """ Return the url of the test server """ - return 'http://localhost:%s' % self._port_value.value + return 'http://{}:{}'.format(self._configured_host, self._port_value.value) def _spawn_live_server(self): self._process = None @@ -477,7 +478,7 @@ def socket_bind_wrapper(self): return ret socketserver.TCPServer.server_bind = socket_bind_wrapper - app.run(port=port, use_reloader=False) + app.run(port=port, use_reloader=False, host=self._configured_host) self._process = multiprocessing.Process( target=worker, args=(self.app, self._configured_port)