feat: универсальный шаблон проектов контура Raisa
- base_templates/: шаблоны платформы fastapi, streamlit, airflow без изменений - contour/: платформа, подтверждённые версии, грабли, профили 4 типов приложений - project-kit/: SDD (S/M/L, delta/spec/plan, constitution, DoR/DoD) + grill, критик тестов, UX gate, handoff; один канон AGENTS.md для Cursor и Claude Code - scripts/init_project.sh: сборка нового проекта или подключение kit к существующему - docs/decisions/0001: что перенесено из elite_vibecoding и dmukp и почему Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139EkK4ShEj52pM9Z5UCwM1
This commit is contained in:
5
base_templates/fastapi/api/src/conf/__init__.py
Normal file
5
base_templates/fastapi/api/src/conf/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from .settings import get_settings
|
||||
|
||||
__all__ = [
|
||||
"get_settings"
|
||||
]
|
||||
9
base_templates/fastapi/api/src/conf/models.py
Normal file
9
base_templates/fastapi/api/src/conf/models.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class ServerSettings(BaseModel):
|
||||
"""
|
||||
Настройки сервера uvicorn
|
||||
"""
|
||||
HOST: str = '0.0.0.0'
|
||||
PORT: int = 8000
|
||||
33
base_templates/fastapi/api/src/conf/settings.py
Normal file
33
base_templates/fastapi/api/src/conf/settings.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from fastapi.logger import logger
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from .models import ServerSettings
|
||||
from functools import lru_cache
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
""" Настройки приложения """
|
||||
ROOT_PATH: str = '/'
|
||||
|
||||
server: ServerSettings = ServerSettings()
|
||||
|
||||
class Config:
|
||||
extra = 'ignore'
|
||||
env_file = ".env"
|
||||
env_nested_delimiter = '__'
|
||||
nested_model_default_partial_update = False
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_settings() -> Settings:
|
||||
"""
|
||||
Получение настроек приложения
|
||||
:return: Настройки приложения
|
||||
"""
|
||||
try:
|
||||
_ = load_dotenv()
|
||||
except Exception as err:
|
||||
logger.error("Error load settings", exc_info=err)
|
||||
return Settings()
|
||||
Reference in New Issue
Block a user