from pydantic_settings import BaseSettings , SettingsConfigDict class Config ( BaseSettings ) : value : bool model_config = SettingsConfigDict ( case_sensitive = False , env_nested_delimiter = "__" , env_file = ( ".env" , ) )
VALUE=1 VALUE=0 VALUE=false VALUE=true VALUE=False VALUE=True
from pydantic import BaseSettings , ValidationError from pydantic_settings import SettingsConfigDict class Config ( BaseSettings ) : value : bool model_config = SettingsConfigDict ( case_sensitive = False , env_nested_delimiter = "__" , env_file = ( ".env" , ) ) if __name__ == "__main__" : try : config = Config ( ) print ( f"Значение:{config.value}" ) except ValidationError as e : print ( f"Ошибка в настройках:{e}" )