diff --git a/application/extensions/__init__.py b/application/extensions/__init__.py index fa32e33033dfccfc168833159e5a4f0bf5df433c..eabf9170e3b0721a0b1743c952f4cc08da23886e 100644 --- a/application/extensions/__init__.py +++ b/application/extensions/__init__.py @@ -13,6 +13,7 @@ from flask import Flask from .init_config import init_config +from .init_cors import init_cors from .init_logger import init_logger from .init_sqlalchemy import init_database from .init_bcrypt import init_bcrypt @@ -31,3 +32,4 @@ def init_plugs(app: Flask) -> None: init_apispec(app) init_marshmallow(app) init_elasticsearch(app) + init_cors(app) diff --git a/application/extensions/init_cors.py b/application/extensions/init_cors.py new file mode 100644 index 0000000000000000000000000000000000000000..0f53f65ed0fb2389c4a07553ecc7ecb2bd8bb91f --- /dev/null +++ b/application/extensions/init_cors.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +# @Version : Python 3.11.4 +# @Software : Sublime Text 4 +# @Author : StudentCWZ +# @Email : StudentCWZ@outlook.com +# @Date : 2023/11/4 15:43 +# @File : init_cors.py +# @Description : +""" + +from flask import Flask +from flask_cors import CORS + + +def init_cors(app: Flask) -> None: + """ + Initialize the dynaconf extension + + :param app: flask.Flask application instance + :return: None + """ + CORS(app)