Fix WSGI support.

This commit is contained in:
Dave Page 2016-08-18 13:43:00 +01:00
parent 48a50ce20b
commit 050937a32a
4 changed files with 45 additions and 17 deletions

View File

@ -71,7 +71,7 @@ application may be configured similarly to the example below:
<VirtualHost *>
ServerName pgadmin.example.com
WSGIDaemonProcess pgadmin processes=1
WSGIDaemonProcess pgadmin processes=1 threads=25
WSGIScriptAlias / /opt/pgAdmin4/web/pgAdmin4.wsgi
<Directory /opt/pgAdmin4/web>
@ -80,4 +80,19 @@ application may be configured similarly to the example below:
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
</VirtualHost>
**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.

View File

@ -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

View File

@ -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())

8
web/pgAdmin4.wsgi Normal file
View File

@ -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