From ce4694830def7c4cfbe1926ddb7b57e608eb926b Mon Sep 17 00:00:00 2001 From: viveksantayana Date: Wed, 31 Aug 2022 00:48:36 +0100 Subject: [PATCH] Added CORS extension --- server/app/__init__.py | 3 ++- server/app/extensions.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/server/app/__init__.py b/server/app/__init__.py index 3ee291b..7a06640 100644 --- a/server/app/__init__.py +++ b/server/app/__init__.py @@ -1,6 +1,6 @@ from .config import Development as Config from .models import * -from .extensions import db +from .extensions import cors, db from flask import Flask from werkzeug.middleware.proxy_fix import ProxyFix @@ -10,6 +10,7 @@ def create_app(): app.config.from_object(Config()) app.wsgi_app = ProxyFix(app.wsgi_app, x_proto = 1, x_host = 1) + cors.init_app(app=app) db.init_app(app=app) from .views import views diff --git a/server/app/extensions.py b/server/app/extensions.py index 589c64f..5e5713d 100644 --- a/server/app/extensions.py +++ b/server/app/extensions.py @@ -1,2 +1,4 @@ +from flask_cors import CORS +cors = CORS() from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() \ No newline at end of file