FastAPI (7) application configuration

Table of contents

1. Create a new folder config under apps

2. Create a new configuration file app_conf.py


 

1. Create a new folder config under apps

2. Create a new configuration file app_conf.py

from functools import lru_cache

from pydantic.v1 import BaseSettings


class AppConfig(BaseSettings):
    app_name: str = "Windows10 插件"


# 开启缓存
@lru_cache
def get_app_settings():
    return AppConfig()


app_settings = get_app_settings()

 

Guess you like

Origin blog.csdn.net/wenxingchen/article/details/132065635