init_dotenv.py 627 Bytes
Newer Older
崔为之's avatar
崔为之 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#!/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/21 10:51
# @File        : init_dotenv.py
# @Description :
"""

import os

from dotenv import load_dotenv


def init_dotenv() -> None:
    """
    Initialize the dotenv extension

    :return: None
    """
    root_path = os.path.abspath(os.path.dirname(__file__)).split('extensions')[0]
    flask_env_path = os.path.join(root_path, '.flaskenv')
    if os.path.exists(flask_env_path):
        load_dotenv(flask_env_path)