init_cors.py 733 Bytes
Newer Older
崔为之's avatar
崔为之 committed
1 2 3 4 5 6 7 8 9
#!/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
崔为之's avatar
崔为之 committed
10
# @Description : Initializes the Flask CORS extension for a Flask application.
崔为之's avatar
崔为之 committed
11 12 13 14 15 16 17 18
"""

from flask import Flask
from flask_cors import CORS


def init_cors(app: Flask) -> None:
    """
崔为之's avatar
崔为之 committed
19
    Initializes the Flask CORS extension for a Flask application.
崔为之's avatar
崔为之 committed
20

崔为之's avatar
崔为之 committed
21 22 23 24 25 26 27 28
    The CORS extension allows for cross-origin resource sharing, enabling
    requests from different domains to the Flask application.

    Args:
        app (Flask): The Flask application.

    Returns:
        None
崔为之's avatar
崔为之 committed
29 30
    """
    CORS(app)