Răsfoiți Sursa

Python 3.8 지원

Surplus_Up (2DU) 6 ani în urmă
părinte
comite
01b0212812
1 a modificat fișierele cu 17 adăugiri și 3 ștergeri
  1. 17 3
      app.py

+ 17 - 3
app.py

@@ -707,7 +707,21 @@ app.wsgi_app = werkzeug.debug.DebuggedApplication(app.wsgi_app, True)
 app.debug = True
 
 if __name__ == "__main__":
-    http_server = tornado.httpserver.HTTPServer(tornado.wsgi.WSGIContainer(app))
-    http_server.listen(server_set['port'], address = server_set['host'])
+    try:
+        http_server = tornado.httpserver.HTTPServer(tornado.wsgi.WSGIContainer(app))
+        http_server.listen(server_set['port'], address = server_set['host'])
 
-    tornado.ioloop.IOLoop.instance().start()
+        tornado.ioloop.IOLoop.instance().start()
+    except Exception as e:
+        if sys.platform == 'win32':
+            try:
+                asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
+                tornado.ioloop.IOLoop.instance().start()
+            except Exception as e:
+                print('----')
+                print(e)
+                raise
+        else:
+            print('----')
+            print(e)
+            raise