init_config.py 775 Bytes
Newer Older
Weizhi Cui's avatar
Weizhi Cui 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/10/28 12:53
# @File        : init_config.py
崔为之's avatar
崔为之 committed
10
# @Description : Initializes the FlaskDynaconf extension for a Flask application.
Weizhi Cui's avatar
Weizhi Cui committed
11 12 13 14 15 16 17 18
"""

from flask import Flask
from dynaconf import FlaskDynaconf


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

    Args:
        app (Flask): The Flask application.
Weizhi Cui's avatar
Weizhi Cui committed
23

崔为之's avatar
崔为之 committed
24 25
    Returns:
    None
Weizhi Cui's avatar
Weizhi Cui committed
26 27 28 29
    """
    FlaskDynaconf(
        app=app,
        loaders=[
崔为之's avatar
崔为之 committed
30 31
            'application.utils.loaders.consul_loader',
            'application.utils.loaders.yaml_loader',
Weizhi Cui's avatar
Weizhi Cui committed
32 33
        ],
    )