Simple Linux Panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mdserver-web/app.py

36 lines
730 B

7 years ago
# coding:utf-8
3 years ago
from gevent import monkey
monkey.patch_all()
7 years ago
import sys
import io
import os
6 years ago
from route import app, socketio
7 years ago
3 years ago
4 years ago
from gevent.pywsgi import WSGIServer
from geventwebsocket.handler import WebSocketHandler
7 years ago
try:
if __name__ == "__main__":
3 years ago
PORT = 7200
if os.path.exists('data/port.pl'):
f = open('data/port.pl')
PORT = int(f.read())
f.close()
6 years ago
HOST = '0.0.0.0'
3 years ago
# if os.path.exists('data/ipv6.pl'):
# HOST = "::1"
3 years ago
4 years ago
http_server = WSGIServer(
(HOST, PORT), app, handler_class=WebSocketHandler)
3 years ago
4 years ago
http_server.serve_forever()
3 years ago
6 years ago
socketio.run(app, host=HOST, port=PORT)
7 years ago
except Exception as ex:
4 years ago
print(ex)