import os, sys, inspect # We need to include the include/ directory in sys.path to ensure that we can # fine everything we need when running in the standalone runtime. This tries # to find the "real" path to use, regardless of any symlinks. includedir = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile(inspect.currentframe()))[0],"include"))) if includedir not in sys.path: sys.path.insert(0, includedir) # Rock n' roll... import cherrypy from time import time,ctime # This is the main application class that we'll run under CherryPy. class pgAdmin4(object): # The main index page @cherrypy.expose def index(self): output = """ Today is %s
This is CherryPy-generated HTML.

pgAdmin 4""" % ctime(time()) return output # A special URL used to "ping" the server @cherrypy.expose def ping(self): return "PING" # 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 # CherryPy default. try: cherrypy.server.socket_port = PGADMIN_PORT except: pass try: cherrypy.quickstart(pgAdmin4()) except IOError: print "Unexpected error: ", sys.exc_info()[0]