From 1f0a05ca9d2b3a128c0926482f88aefb9a14f996 Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Fri, 31 May 2019 10:41:28 +0530 Subject: [PATCH] Allows CORS --- README.md | 2 +- server.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cbed37e..0a588bb 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Source code for [Questable Bot](https://t.me/questable_bot) and the relevant ## Questable API Server + Install the dependencies - + `pip3 install Flask` + + `pip3 install Flask flask_cors` + Install `gunicorn` + `pip3 install gunicorn` + Run `gunicorn3 -b 127.0.0.1:5000 server:app`. Change port if you want to run diff --git a/server.py b/server.py index 3aba77c..4b3c8f2 100644 --- a/server.py +++ b/server.py @@ -4,8 +4,10 @@ import questable import sqlite3 import errors from flask import Flask, jsonify, request, redirect +from flask_cors import CORS app = Flask(__name__) +CORS(app) db = sqlite3.connect("questable.db", check_same_thread=False)