2023-02-20 11:09:43 +03:00
|
|
|
import os
|
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
|
|
|
|
2023-02-20 11:09:43 +03:00
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
2023-02-18 20:17:16 +03:00
|
|
|
from fastapi.templating import Jinja2Templates
|
|
|
|
from pydantic import BaseSettings
|
|
|
|
|
|
|
|
|
2023-02-19 15:19:18 +03:00
|
|
|
file_dir = Path(__file__).parent
|
|
|
|
templates_dir = str(
|
|
|
|
file_dir.parent / 'templates'
|
|
|
|
)
|
|
|
|
static_dir = str(
|
|
|
|
file_dir.parent / 'static'
|
|
|
|
)
|
2023-02-20 11:09:43 +03:00
|
|
|
|
|
|
|
|
|
|
|
class Settings(BaseSettings):
|
2023-02-27 17:49:30 +03:00
|
|
|
debug: bool = False
|
2023-02-20 11:09:43 +03:00
|
|
|
session_key: str = secrets.token_hex(32)
|
|
|
|
csrf_key: str = secrets.token_hex(32)
|
|
|
|
|
|
|
|
settings = Settings()
|
2023-02-19 15:19:18 +03:00
|
|
|
|
|
|
|
|
2023-02-18 20:17:16 +03:00
|
|
|
templates = Jinja2Templates(
|
2023-02-19 15:19:18 +03:00
|
|
|
directory=templates_dir,
|
2023-02-18 20:17:16 +03:00
|
|
|
)
|