Added CORS extension

This commit is contained in:
Vivek Santayana 2022-08-31 00:48:36 +01:00
parent f7c6081ca0
commit ce4694830d
2 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,6 @@
from .config import Development as Config from .config import Development as Config
from .models import * from .models import *
from .extensions import db from .extensions import cors, db
from flask import Flask from flask import Flask
from werkzeug.middleware.proxy_fix import ProxyFix from werkzeug.middleware.proxy_fix import ProxyFix
@ -10,6 +10,7 @@ def create_app():
app.config.from_object(Config()) app.config.from_object(Config())
app.wsgi_app = ProxyFix(app.wsgi_app, x_proto = 1, x_host = 1) app.wsgi_app = ProxyFix(app.wsgi_app, x_proto = 1, x_host = 1)
cors.init_app(app=app)
db.init_app(app=app) db.init_app(app=app)
from .views import views from .views import views

View File

@ -1,2 +1,4 @@
from flask_cors import CORS
cors = CORS()
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy() db = SQLAlchemy()