tmpl-fastapi/app/common.py

17 lines
341 B
Python

import secrets
from fastapi.templating import Jinja2Templates
from pydantic import BaseSettings
class Settings(BaseSettings):
secret_key: str = secrets.token_hex(32)
templates_dir: str = '../templates'
static_dir: str = '../static'
settings = Settings()
templates = Jinja2Templates(
directory=settings.templates_dir,
)