MCPcopy Create free account
hub / github.com/pywebio/PyWebIO / wsgi_app

Function wsgi_app

pywebio/platform/flask.py:105–131  ·  view source on GitHub ↗

Get the Flask WSGI app for running PyWebIO applications. The arguments of ``wsgi_app()`` have the same meaning as for :func:`pywebio.platform.flask.start_server`

(applications, cdn=True,
             static_dir=None,
             allowed_origins=None, check_origin=None,
             session_expire_seconds=None,
             session_cleanup_interval=None,
             max_payload_size='200M')

Source from the content-addressed store, hash-verified

103
104
105def wsgi_app(applications, cdn=True,
106 static_dir=None,
107 allowed_origins=None, check_origin=None,
108 session_expire_seconds=None,
109 session_cleanup_interval=None,
110 max_payload_size='200M'):
111 """Get the Flask WSGI app for running PyWebIO applications.
112
113 The arguments of ``wsgi_app()`` have the same meaning as for :func:`pywebio.platform.flask.start_server`
114 """
115 cdn = cdn_validation(cdn, 'warn')
116
117 app = Flask(__name__) if static_dir is None else Flask(__name__, static_url_path="/static",
118 static_folder=static_dir)
119 page.MAX_PAYLOAD_SIZE = app.config['MAX_CONTENT_LENGTH'] = parse_file_size(max_payload_size)
120
121 app.add_url_rule('/', 'webio_view', webio_view(
122 applications=applications, cdn=cdn,
123 session_expire_seconds=session_expire_seconds,
124 session_cleanup_interval=session_cleanup_interval,
125 allowed_origins=allowed_origins,
126 check_origin=check_origin
127 ), methods=['GET', 'POST', 'OPTIONS'])
128
129 app.add_url_rule('/<path:p>', 'pywebio_static', lambda p: send_from_directory(STATIC_PATH, p))
130
131 return app
132
133
134def start_server(applications, port=8080, host='', cdn=True,

Callers 1

start_serverFunction · 0.70

Calls 3

cdn_validationFunction · 0.85
parse_file_sizeFunction · 0.85
webio_viewFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…