31 lines
555 B
Python
31 lines
555 B
Python
import secrets
|
|
from pathlib import Path
|
|
|
|
from fastapi.templating import Jinja2Templates
|
|
from pydantic import BaseSettings
|
|
|
|
|
|
# Directories
|
|
file_dir = Path(__file__).parent
|
|
templates_dir = str(
|
|
file_dir.parent / 'templates'
|
|
)
|
|
static_dir = str(
|
|
file_dir.parent / 'static'
|
|
)
|
|
|
|
|
|
# Main configuration
|
|
class Settings(BaseSettings):
|
|
debug: bool = False
|
|
session_key: str = secrets.token_hex(32)
|
|
csrf_key: str = secrets.token_hex(32)
|
|
|
|
|
|
settings = Settings()
|
|
|
|
|
|
# Jinja templates handler
|
|
templates = Jinja2Templates(
|
|
directory=templates_dir,
|
|
)
|