Comment code of launching modes

master
pictuga 2015-08-28 19:18:09 +02:00
parent 5e87b56a03
commit 4f9000beed
1 changed files with 3 additions and 0 deletions

View File

@ -669,14 +669,17 @@ def cli_app():
def main(): def main():
if 'REQUEST_URI' in os.environ: if 'REQUEST_URI' in os.environ:
# mod_cgi
wsgiref.handlers.CGIHandler().run(cgi_wrapper) wsgiref.handlers.CGIHandler().run(cgi_wrapper)
elif len(sys.argv) <= 1: elif len(sys.argv) <= 1:
# start internal (basic) http server
print('Serving http://localhost:%s/'%PORT) print('Serving http://localhost:%s/'%PORT)
httpd = wsgiref.simple_server.make_server('', PORT, cgi_wrapper) httpd = wsgiref.simple_server.make_server('', PORT, cgi_wrapper)
httpd.serve_forever() httpd.serve_forever()
else: else:
# as a CLI app
try: try:
cli_app() cli_app()
except (KeyboardInterrupt, SystemExit): except (KeyboardInterrupt, SystemExit):