Skip to content

Commit

Permalink
feat: add TEMPLATES_PATH env
Browse files Browse the repository at this point in the history
  • Loading branch information
daxartio committed Oct 25, 2024
1 parent 8076b1f commit 5aad9bd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sportorg/config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import logging.config
import os
import sys
from typing import Optional

from pydantic import BaseSettings


class Env(BaseSettings):
DEBUG: bool = False
TEMPLATES_PATH: Optional[str]

class Config:
env_file = '.env'
Expand Down Expand Up @@ -34,6 +36,8 @@ def base_dir(*paths) -> str:
return os.path.join(BASE_DIR, *paths)


env = Env(_env_file=base_dir('.env')) # type:ignore
DEBUG = env.DEBUG
IMG_DIR = base_dir('img')


Expand Down Expand Up @@ -62,7 +66,7 @@ def data_dir(*paths) -> str:
return os.path.join(DATA_DIR, *paths)


TEMPLATE_DIR = base_dir('templates')
TEMPLATE_DIR = env.TEMPLATES_PATH or base_dir('templates')


def template_dir(*paths) -> str:
Expand All @@ -83,9 +87,6 @@ def style_dir(*paths) -> str:
return os.path.join(STYLE_DIR, *paths)


env = Env(_env_file=base_dir('.env')) # type:ignore
DEBUG = env.DEBUG

ICON = icon_dir('sportorg.svg')

CONFIG_INI = data_dir('config.ini')
Expand Down

0 comments on commit 5aad9bd

Please sign in to comment.