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))
| 137 | |
| 138 | |
| 139 | def 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 | |
| 167 | def WSGIServer(server_address, wsgi_app): |
nothing calls this directly
no test coverage detected