2016-11-27 09:06:11 +00:00
|
|
|
import gevent.monkey
|
|
|
|
gevent.monkey.patch_all()
|
2016-09-18 08:33:46 +00:00
|
|
|
|
2017-11-26 10:37:11 +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)
|
|
|
|
|
2017-05-02 04:49:28 +00:00
|
|
|
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),
|
2017-05-02 04:49:28 +00:00
|
|
|
application=etiquette_flask.site,
|
2017-12-16 11:45:07 +00:00
|
|
|
keyfile='D:\\git\\etiquette\\frontends\\etiquette_flask\\https\\etiquette.key',
|
|
|
|
certfile='D:\\git\\etiquette\\frontends\\etiquette_flask\\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),
|
2017-05-02 04:49:28 +00:00
|
|
|
application=etiquette_flask.site,
|
2016-11-27 09:06:11 +00:00
|
|
|
)
|
|
|
|
|
2016-09-18 08:33:46 +00:00
|
|
|
|
2016-12-13 03:49:36 +00:00
|
|
|
print('Starting server on port %d' % port)
|
2016-12-16 11:27:39 +00:00
|
|
|
http.serve_forever()
|