Allow Werkzeug to be configured to bind to adaptors other than localhost for testing.

pull/3/head
Murtuza Zabuawala 2016-05-06 15:25:52 +01:00 committed by Dave Page
parent 4190933909
commit 3eb51e93e7
2 changed files with 13 additions and 1 deletions

View File

@ -98,6 +98,16 @@ SERVER_MODE = True
# The default should be fine here, as it's not exposed in the app.
DESKTOP_USER = 'pgadmin4@pgadmin.org'
# This configuration otion allows the user to host the application on a LAN
# Default hosting is on localhost (DEFAULT_SERVER='localhost').
# To host pgAdmin4 over LAN set DEFAULT_SERVER='0.0.0.0' (or a specific
# adaptor address.
#
# NOTE: This is NOT recommended for production use, only for debugging
# or testing. Production installations should be run as a WSGI application
# behind Apache HTTPD.
DEFAULT_SERVER = 'localhost'
# The default port on which the app server will listen if not set in the
# environment by the runtime
DEFAULT_SERVER_PORT = 5050

View File

@ -74,6 +74,8 @@ else:
server_port = config.DEFAULT_SERVER_PORT
try:
app.run(port=server_port, use_reloader=(config.SERVER_MODE and app.debug))
app.run(host=config.DEFAULT_SERVER,
port=server_port,
use_reloader=(config.SERVER_MODE and app.debug))
except IOError:
app.logger.error("Error starting the app server: %s", sys.exc_info())