else/Templates/flask/flasksite_launch.py

30 lines
590 B
Python
Raw Normal View History

2016-11-19 03:23:57 +00:00
import gevent.monkey
gevent.monkey.patch_all()
import flasksite
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-11-03 19:50:16 +00:00
listener=('0.0.0.0', port),
2016-11-19 03:23:57 +00:00
application=flasksite.site,
keyfile='https\\flasksite.key',
certfile='https\\flasksite.crt',
)
else:
http = gevent.pywsgi.WSGIServer(
2017-11-03 19:50:16 +00:00
listener=('0.0.0.0', port),
2016-11-19 03:23:57 +00:00
application=flasksite.site,
)
2017-11-03 19:50:16 +00:00
print('Starting server on port %d' % port)
2016-11-19 03:23:57 +00:00
http.serve_forever()