2023-02-18 20:17:16 +03:00
|
|
|
import secrets
|
2023-02-18 20:25:47 +03:00
|
|
|
from pathlib import Path
|
2023-02-18 20:17:16 +03:00
|
|
|
|
|
|
|
from fastapi.templating import Jinja2Templates
|
|
|
|
from pydantic import BaseSettings
|
|
|
|
|
|
|
|
|
2023-02-18 20:25:47 +03:00
|
|
|
file_dir = Path(__file__).parent
|
|
|
|
|
2023-02-18 20:17:16 +03:00
|
|
|
class Settings(BaseSettings):
|
|
|
|
secret_key: str = secrets.token_hex(32)
|
2023-02-18 20:25:47 +03:00
|
|
|
templates_dir: str = str(
|
|
|
|
file_dir.parent / 'templates'
|
|
|
|
)
|
|
|
|
static_dir: str = str(
|
|
|
|
file_dir.parent / 'static'
|
|
|
|
)
|
2023-02-18 20:17:16 +03:00
|
|
|
|
|
|
|
settings = Settings()
|
|
|
|
|
|
|
|
|
|
|
|
templates = Jinja2Templates(
|
|
|
|
directory=settings.templates_dir,
|
|
|
|
)
|