py.lib

Yohn Y. 2019-09-30 Parent:15fa2da6627d Child:b18b6e30d6ba

8:a1729effde3c Browse Files

. Убиваем ненужное

pgAdmin4_server.py

     1.1 --- a/pgAdmin4_server.py	Sun Jan 20 22:24:08 2019 +0300
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,67 +0,0 @@
     1.4 -# coding: utf-8
     1.5 -# devel.a0fs.net: pgadmin.selfServer - v0.2 by awgur $
     1.6 -
     1.7 -##########################################################################
     1.8 -#
     1.9 -# pgAdmin 4 - PostgreSQL Tools
    1.10 -#
    1.11 -# Copyright (C) 2013 - 2018, The pgAdmin Development Team
    1.12 -# This software is released under the PostgreSQL Licence
    1.13 -#
    1.14 -##########################################################################
    1.15 -
    1.16 -import os
    1.17 -import sys
    1.18 -
    1.19 -try:
    1.20 -    import waitress
    1.21 -except ImportError:
    1.22 -    sys.stderr.write('\n ERROR: You need to install weitress module to you python instance\n\n')
    1.23 -    sys.exit(1)
    1.24 -    
    1.25 -import logging
    1.26 -from logging.handlers import SysLogHandler
    1.27 -
    1.28 -
    1.29 -def prepLogger():
    1.30 -    _format = 'lo.ad.pgadmin[%(process)d]: %(message)s'
    1.31 -    _logHandler = SysLogHandler(address='/dev/log', facility='user')
    1.32 -    _logHandler.setFormatter(logging.Formatter(_format))    
    1.33 -    logging.basicConfig(level=logging.INFO)
    1.34 -    _log = logging.getLogger()
    1.35 -    _log.handlers = [_logHandler,]
    1.36 -
    1.37 -root = os.path.dirname(os.path.realpath(__file__))
    1.38 -if sys.path[0] != root:
    1.39 -    sys.path.insert(0, root)
    1.40 -
    1.41 -if sys.version_info[0] >= 3:
    1.42 -    import builtins
    1.43 -else:
    1.44 -    import __builtin__ as builtins
    1.45 -
    1.46 -# Ensure the global server mode is set.
    1.47 -builtins.SERVER_MODE = True
    1.48 -
    1.49 -import config
    1.50 -config.DATA_DIR = os.getenv('DATA_DIR') or config.DATA_DIR
    1.51 -config.SQLITE_PATH = os.getenv('SQLITE_PATH') or os.path.join(config.DATA_DIR, 'pgadmin4.db')
    1.52 -config.SESSION_DB_PATH = os.path.join(config.DATA_DIR, 'sessions')
    1.53 -config.STORAGE_DIR = os.path.join(config.DATA_DIR, 'storage')
    1.54 -config.TEST_SQLITE_PATH = os.path.join(config.DATA_DIR, 'test_pgadmin4.db')
    1.55 -config.LOG_FILE = os.path.join(config.DATA_DIR, 'pgadmin4.log')
    1.56 -
    1.57 -# When running it as a WSGI application, directory for the configuration file
    1.58 -# must present.
    1.59 -if not os.path.exists(os.path.dirname(config.SQLITE_PATH)):
    1.60 -        raise Exception(
    1.61 -                        """
    1.62 -                        Required configuration file is not present!
    1.63 -                        Please run setup.py first!"""
    1.64 -                            )
    1.65 -
    1.66 -from pgAdmin4 import app as application
    1.67 -prepLogger()
    1.68 -log = logging.getLogger()
    1.69 -
    1.70 -waitress.serve(application, host='0.0.0.0', port=44000)