2017-10-09 04:39:07 +00:00
|
|
|
import logging
|
|
|
|
logging.getLogger('googleapicliet.discovery_cache').setLevel(logging.ERROR)
|
|
|
|
|
2016-11-29 04:16:16 +00:00
|
|
|
import gevent.monkey
|
|
|
|
gevent.monkey.patch_all()
|
|
|
|
|
|
|
|
import gevent.pywsgi
|
|
|
|
import sys
|
2016-12-07 06:11:09 +00:00
|
|
|
|
2017-10-09 04:39:07 +00:00
|
|
|
import ycdl_flask
|
2016-11-29 04:16:16 +00:00
|
|
|
|
|
|
|
if len(sys.argv) == 2:
|
|
|
|
port = int(sys.argv[1])
|
|
|
|
else:
|
|
|
|
port = 5000
|
|
|
|
|
|
|
|
if port == 443:
|
|
|
|
http = gevent.pywsgi.WSGIServer(
|
|
|
|
listener=('', port),
|
2017-10-09 04:39:07 +00:00
|
|
|
application=ycdl_flask.site,
|
2016-11-29 04:16:16 +00:00
|
|
|
keyfile='https\\flasksite.key',
|
|
|
|
certfile='https\\flasksite.crt',
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
http = gevent.pywsgi.WSGIServer(
|
2017-10-09 04:39:07 +00:00
|
|
|
listener=('0.0.0.0', port),
|
|
|
|
application=ycdl_flask.site,
|
2016-11-29 04:16:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2016-12-07 06:11:09 +00:00
|
|
|
print('Starting server on port %d' % port)
|
2016-11-29 04:16:16 +00:00
|
|
|
http.serve_forever()
|