You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.0 KiB
Django/Jinja
51 lines
1.0 KiB
Django/Jinja
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from iti.config import (
|
|
DevConfig as BaseDevConfig,
|
|
TestConfig as BaseTestConfig,
|
|
ProdConfig as BaseProdConfig,
|
|
)
|
|
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent
|
|
APP_NAME = "{{ project_name }}"
|
|
|
|
|
|
def runtime_path(name: str) -> str:
|
|
return str(BASE_DIR / "runtime" / name)
|
|
|
|
|
|
def apply_project_config(config) -> None:
|
|
config.app_name = APP_NAME
|
|
config.base_dir = BASE_DIR
|
|
config.file_storage["LOCAL"]["base_path"] = runtime_path("uploads")
|
|
config.log_dir = runtime_path("logs")
|
|
|
|
|
|
class DevConfig(BaseDevConfig):
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
apply_project_config(self)
|
|
|
|
|
|
class TestConfig(BaseTestConfig):
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
apply_project_config(self)
|
|
|
|
|
|
class ProdConfig(BaseProdConfig):
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
apply_project_config(self)
|
|
|
|
|
|
config = {
|
|
"dev": DevConfig,
|
|
"test": TestConfig,
|
|
"prod": ProdConfig,
|
|
"default": DevConfig,
|
|
}
|