mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
##########################################################################
|
|
#
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
#
|
|
# Copyright (C) 2013 - 2014, The pgAdmin Development Team
|
|
# This software is released under the PostgreSQL Licence
|
|
#
|
|
# pgAdmin4.py - Main application entry point
|
|
#
|
|
##########################################################################
|
|
|
|
import os, sys
|
|
|
|
# We need to include the root directory in sys.path to ensure that we can
|
|
# find everything we need when running in the standalone runtime.
|
|
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
|
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'pgadmin'))
|
|
|
|
import config
|
|
from pgadmin import create_app
|
|
|
|
##########################################################################
|
|
# Server starup
|
|
##########################################################################
|
|
|
|
# Create the app!
|
|
app = create_app()
|
|
app.logger.debug("Python syspath: %s", sys.path)
|
|
|
|
# Start the web server. The port number should have already been set by the
|
|
# runtime if we're running in desktop mode, otherwise we'll just use the
|
|
# Flask default.
|
|
if 'PGADMIN_PORT' in globals():
|
|
app.logger.debug('PGADMIN_PORT set in the runtime environment to %s', PGADMIN_PORT)
|
|
server_port = PGADMIN_PORT
|
|
else:
|
|
app.logger.debug('PGADMIN_PORT is not set in the runtime environment, using default of %s', config.DEFAULT_SERVER_PORT)
|
|
server_port = config.DEFAULT_SERVER_PORT
|
|
|
|
try:
|
|
app.run(port=server_port)
|
|
except IOError:
|
|
app.logger.error("Error starting the app server: %s", sys.exc_info())
|
|
|