etiquette/frontends/etiquette_flask/etiquette_flask_launch.py

36 lines
891 B
Python
Raw Normal View History

2016-11-27 09:06:11 +00:00
import gevent.monkey
gevent.monkey.patch_all()
2016-09-18 08:33:46 +00:00
import logging
handler = logging.StreamHandler()
log_format = '{levelname}:etiquette.{module}.{funcName}: {message}'
handler.setFormatter(logging.Formatter(log_format, style='{'))
logging.getLogger().addHandler(handler)
import etiquette_flask
2016-09-18 08:33:46 +00:00
import gevent.pywsgi
import gevent.wsgi
import sys
if len(sys.argv) == 2:
port = int(sys.argv[1])
else:
port = 5000
if port == 443:
http = gevent.pywsgi.WSGIServer(
2017-01-30 01:47:59 +00:00
listener=('0.0.0.0', port),
application=etiquette_flask.site,
2016-11-27 09:06:11 +00:00
keyfile='C:\\git\\etiquette\\etiquette\\https\\etiquette.key',
certfile='C:\\git\\etiquette\\etiquette\\https\\etiquette.crt',
2016-09-18 08:33:46 +00:00
)
else:
2016-11-27 09:06:11 +00:00
http = gevent.pywsgi.WSGIServer(
2017-01-30 01:47:59 +00:00
listener=('0.0.0.0', port),
application=etiquette_flask.site,
2016-11-27 09:06:11 +00:00
)
2016-09-18 08:33:46 +00:00
print('Starting server on port %d' % port)
2016-12-16 11:27:39 +00:00
http.serve_forever()