示例#1
0
def main():
    # TODO: Добавить автоматическое приведение типов аргументов
    # TODO: Добавить авторизацию пользователей
    # TODO: Добавить обработку завершающего слеша

    from wsgiserver import WSGIRequestHandler, WSGIServer

    server = WSGIServer(port=8080, request_handler_cls=WSGIRequestHandler)
    server.set_app(app)
    server.serve_forever()
示例#2
0
def main():
    from wsgiserver import WSGIRequestHandler, WSGIServer

    server = WSGIServer(port=8080, request_handler_cls=WSGIRequestHandler)
    server.set_app(application)
    server.serve_forever()
示例#3
0
import configparser
from app import create_app, socketio

app = create_app()

config = configparser.ConfigParser()
config.read("config.ini")

if __name__ == '__main__':
    if config['ssl']['enabled'] == 'yes':
        import ssl
        from wsgiserver import WSGIServer

        ctx = ssl.SSLContext(protocol=ssl.PROTOCOL_TLSv1_2)
        ctx.load_cert_chain(config['ssl']['certificate'], config['ssl']['key'])

        http_server = WSGIServer(
            (config['server']['host'], config['server']['port']),
            app,
            certfile=config['ssl']['certificate'],
            keyfile=config['ssl']['key'])
        http_server.serve_forever()
        socketio.run(app,
                     config['server']['host'],
                     int(config['server']['port']),
                     ssl_context=ctx)
    else:
        socketio.run(app, config['server']['host'],
                     int(config['server']['port']))