From 8b1c09c96c956f5578a096f664596a44c526cf45 Mon Sep 17 00:00:00 2001 From: cuiweizhi <560397@gree.com.cn> Date: Sat, 4 Nov 2023 15:45:50 +0800 Subject: [PATCH] Update project --- application/extensions/__init__.py | 2 ++ application/extensions/init_cors.py | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 application/extensions/init_cors.py diff --git a/application/extensions/__init__.py b/application/extensions/__init__.py index fa32e33..eabf917 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 0000000..0f53f65 --- /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) -- GitLab