itplanning/ITPlanning/config.py

28 lines
563 B
Python
Raw Normal View History

2021-05-25 19:01:20 +00:00
""" config management """
from os import makedirs, path
import tempfile
current_config = None
class DefaultConfig:
DEBUG = False
SECRET_KEY="toto"
tempdir= path.join(tempfile.gettempdir(), "ITPlanning")
BASE = {
"database_uri": "sqlite:///" + path.join(tempdir, "ITPlanning.db"),
}
def __init__(self):
if not path.exists(self.tempdir):
makedirs(self.tempdir)
current_config = self
def get_current_config():
if current_config is None:
DefaultConfig()
return current_config