MCPcopy Index your code
hub / github.com/webpy/webpy / runsimple

Function runsimple

web/httpserver.py:139–164  ·  view source on GitHub ↗

Runs [CherryPy][cp] WSGI server hosting WSGI app `func`. The directory `static/` is hosted statically. [cp]: http://www.cherrypy.org

(func, server_address=("0.0.0.0", 8080))

Source from the content-addressed store, hash-verified

137
138
139def runsimple(func, server_address=("0.0.0.0", 8080)):
140 """
141 Runs [CherryPy][cp] WSGI server hosting WSGI app `func`.
142 The directory `static/` is hosted statically.
143
144 [cp]: http://www.cherrypy.org
145 """
146 global server
147 func = StaticMiddleware(func)
148 func = LogMiddleware(func)
149
150 server = WSGIServer(server_address, func)
151
152 if "/" in server_address[0]:
153 print("%s" % server_address)
154 else:
155 if server.ssl_adapter:
156 print("https://%s:%d/" % server_address)
157 else:
158 print("http://%s:%d/" % server_address)
159
160 try:
161 server.start()
162 except (KeyboardInterrupt, SystemExit):
163 server.stop()
164 server = None
165
166
167def WSGIServer(server_address, wsgi_app):

Callers

nothing calls this directly

Calls 4

StaticMiddlewareClass · 0.85
LogMiddlewareClass · 0.85
stopMethod · 0.80
WSGIServerFunction · 0.70

Tested by

no test coverage detected