|
|
|
@ -12,16 +12,16 @@ |
|
|
|
|
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 |
|
|
|
|
from gevent.pywsgi import WSGIServer |
|
|
|
|
from geventwebsocket.handler import WebSocketHandler |
|
|
|
|
|
|
|
|
|
from gevent import monkey |
|
|
|
|
monkey.patch_all() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# from requests.packages.urllib3.util.ssl_ import create_urllib3_context |
|
|
|
|
# create_urllib3_context() |
|
|
|
|
|
|
|
|
@ -38,21 +38,15 @@ if sys.path[0] != os.path.dirname(os.path.realpath(__file__)): |
|
|
|
|
|
|
|
|
|
def main(): |
|
|
|
|
|
|
|
|
|
# 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) |
|
|
|
|
try: |
|
|
|
|
http_server = WSGIServer( |
|
|
|
|
(HOST, PORT), app, handler_class=WebSocketHandler) |
|
|
|
|
http_server.serve_forever() |
|
|
|
|
socketio.run(app, host=config.DEFAULT_SERVER,debug=config.DEBUG) |
|
|
|
|
except Exception as e: |
|
|
|
|
print(str(e)) |
|
|
|
|
|
|
|
|
|
# app.run(debug=True) |
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
main() |
|
|
|
|