diff --git a/docs/en_US/server_deployment.rst b/docs/en_US/server_deployment.rst index b48c3ee3b..3b67784e3 100644 --- a/docs/en_US/server_deployment.rst +++ b/docs/en_US/server_deployment.rst @@ -71,7 +71,7 @@ application may be configured similarly to the example below: ServerName pgadmin.example.com - WSGIDaemonProcess pgadmin processes=1 + WSGIDaemonProcess pgadmin processes=1 threads=25 WSGIScriptAlias / /opt/pgAdmin4/web/pgAdmin4.wsgi @@ -80,4 +80,19 @@ application may be configured similarly to the example below: Order deny,allow Allow from all - \ No newline at end of file + + +**Note:** If you're using Apache HTTPD 2.4 or later, replace the lines: + +.. code-block:: apache + + Order deny,allow + Allow from all + +with: + +.. code-block:: apache + + Require all granted + +Adjust as needed to suit your access control requirements. \ No newline at end of file diff --git a/web/config.py b/web/config.py index 6c6bba29d..2f7262638 100644 --- a/web/config.py +++ b/web/config.py @@ -153,7 +153,10 @@ SECURITY_PASSWORD_SALT = 'SuperSecret3' SECURITY_PASSWORD_HASH = 'pbkdf2_sha512' # Should HTML be minified on the fly when not in debug mode? -MINIFY_HTML = True +# Note: This is disabled by default as it will error when processing the +# docs. If the serving of docs is handled by an Apache HTTPD +# instance (rather than via the app), then it can be safely enabled. +MINIFY_HTML = False ########################################################################## # Server Connection Driver Settings diff --git a/web/pgAdmin4.py b/web/pgAdmin4.py index b679cd62e..707785b3c 100644 --- a/web/pgAdmin4.py +++ b/web/pgAdmin4.py @@ -80,18 +80,20 @@ else: # Let the application save the status about the runtime for using it later. app.PGADMIN_RUNTIME = PGADMIN_RUNTIME -# Output a startup message if we're not under the runtime -if not PGADMIN_RUNTIME: - print("Starting %s. Please navigate to http://localhost:%d in your browser." % - (config.APP_NAME, server_port)) - sys.stdout.flush() +# Output a startup message if we're not under the runtime and startup. +# If we're under WSGI, we don't need to worry about this +if __name__ == '__main__': + if not PGADMIN_RUNTIME: + print("Starting %s. Please navigate to http://localhost:%d in your browser." % + (config.APP_NAME, server_port)) + sys.stdout.flush() -try: - app.run( - host=config.DEFAULT_SERVER, - port=server_port, - use_reloader=((not PGADMIN_RUNTIME) and app.debug), - threaded=config.THREADED_MODE - ) -except IOError: - app.logger.error("Error starting the app server: %s", sys.exc_info()) + try: + app.run( + host=config.DEFAULT_SERVER, + port=server_port, + use_reloader=((not PGADMIN_RUNTIME) and app.debug), + threaded=config.THREADED_MODE + ) + except IOError: + app.logger.error("Error starting the app server: %s", sys.exc_info()) diff --git a/web/pgAdmin4.wsgi b/web/pgAdmin4.wsgi new file mode 100644 index 000000000..d74cecf27 --- /dev/null +++ b/web/pgAdmin4.wsgi @@ -0,0 +1,8 @@ +import os +import sys + +root = os.path.dirname(os.path.realpath(__file__)) +if sys.path[0] != root: + sys.path.insert(0, root) + +from pgAdmin4 import app as application