From f93dab2d0358c3538ab1f86b77fa2d8cbbf18569 Mon Sep 17 00:00:00 2001 From: JiaJunsu Date: Sat, 2 Feb 2019 01:53:38 +0800 Subject: [PATCH] Support CORS --- calculator_of_Onmyoji/cm_server.py | 4 +++- requirements.txt | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/calculator_of_Onmyoji/cm_server.py b/calculator_of_Onmyoji/cm_server.py index b2fcec2..2b71d3c 100644 --- a/calculator_of_Onmyoji/cm_server.py +++ b/calculator_of_Onmyoji/cm_server.py @@ -11,6 +11,7 @@ import webbrowser import flask +from flask_cors import CORS from webob import exc from calculator_of_Onmyoji import cal_mitama @@ -25,6 +26,7 @@ else: app = flask.Flask(__name__) +CORS(app) work_path = os.path.dirname(os.path.realpath(__file__)) @@ -78,4 +80,4 @@ def open_browser(host, port): t = threading.Thread(target=open_browser, args=(host, port)) t.start() - app.run(host=host, port=port) + app.run(host=host, port=port, threaded=True) diff --git a/requirements.txt b/requirements.txt index 6f43c6c..5009c1c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ xlwt requests tqdm flask +flask-cors webob