mdserver-web/app.py

27 lines
561 B
Python
Raw Normal View History

2018-10-25 04:40:45 -04:00
# coding:utf-8
2021-12-04 22:40:55 -05:00
from gevent import monkey
monkey.patch_all()
2018-10-02 09:50:10 -04:00
import sys
import io
import os
2019-02-18 03:21:31 -05:00
from route import app, socketio
2018-10-14 05:37:43 -04:00
2021-12-04 22:29:12 -05:00
2021-11-08 05:31:00 -05:00
from gevent.pywsgi import WSGIServer
from geventwebsocket.handler import WebSocketHandler
2018-10-26 01:53:39 -04:00
try:
if __name__ == "__main__":
2021-12-04 22:40:10 -05:00
f = open('data/port.pl')
PORT = int(f.read())
2019-02-18 03:21:31 -05:00
HOST = '0.0.0.0'
2021-12-04 22:40:10 -05:00
2021-11-08 05:31:00 -05:00
http_server = WSGIServer(
(HOST, PORT), app, handler_class=WebSocketHandler)
http_server.serve_forever()
2019-02-18 03:21:31 -05:00
socketio.run(app, host=HOST, port=PORT)
2018-10-26 01:53:39 -04:00
except Exception as ex:
2021-04-30 23:31:51 -04:00
print(ex)