Update app.py
This commit is contained in:
parent
85c62dd51a
commit
41978d33bd
43
web/app.py
43
web/app.py
|
|
@ -8,17 +8,18 @@
|
|||
# Author: midoks <midoks@163.com>
|
||||
# ---------------------------------------------------------------------------------
|
||||
|
||||
# import eventlet
|
||||
# eventlet.monkey_patch()
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# from admin import create_app
|
||||
from admin import app, socketio
|
||||
import config
|
||||
|
||||
from gevent.pywsgi import WSGIServer
|
||||
from geventwebsocket.handler import WebSocketHandler
|
||||
|
||||
import eventlet
|
||||
eventlet.monkey_patch(socket=True, select=True)
|
||||
# from gevent.pywsgi import WSGIServer
|
||||
# from geventwebsocket.handler import WebSocketHandler
|
||||
|
||||
|
||||
if sys.version_info < (3, 6):
|
||||
|
|
@ -28,21 +29,27 @@ if sys.version_info < (3, 6):
|
|||
if sys.path[0] != os.path.dirname(os.path.realpath(__file__)):
|
||||
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
|
||||
|
||||
|
||||
# print(config.DEFAULT_SERVER,config.DEFAULT_SERVER_PORT)
|
||||
# app = create_app()
|
||||
|
||||
def main():
|
||||
# http_server = WSGIServer(
|
||||
# (HOST, PORT), app, handler_class=WebSocketHandler)
|
||||
# http_server.serve_forever()
|
||||
# socketio.run(app, host=HOST, port=PORT)
|
||||
|
||||
socketio.run(
|
||||
app,
|
||||
debug=config.DEBUG,
|
||||
allow_unsafe_werkzeug=True,
|
||||
host=config.DEFAULT_SERVER,
|
||||
port=7201,
|
||||
)
|
||||
|
||||
# try:
|
||||
# # http_server = WSGIServer(
|
||||
# # (HOST, PORT), app, handler_class=WebSocketHandler)
|
||||
# # http_server.serve_forever()
|
||||
# # socketio.run(app, host=HOST, port=PORT)
|
||||
# socketio.run(
|
||||
# app,
|
||||
# debug=config.DEBUG,
|
||||
# host=config.DEFAULT_SERVER,
|
||||
# port=7201,
|
||||
# )
|
||||
# except Exception as e:
|
||||
# print(str(e))
|
||||
|
||||
app.run(debug=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
main()
|
||||
|
|
|
|||
Loading…
Reference in New Issue