This repository has been archived on 2020-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
magic-app/magic_app/config.py

53 lines
1.1 KiB
Python

"""The Application settings."""
from os import environ, pardir
from os.path import abspath, dirname, join
from pathlib import Path
class Base:
"""The base configuration."""
DEBUG = False
JSON_AS_ASCII = False
SECRET_KEY = environ["SECRET_KEY"]
APP_DIR = abspath(dirname(__file__))
PROJECT_ROOT = abspath(join(APP_DIR, pardir))
REDIS_HOST = environ["REDIS_HOST"]
REDIS_PORT = environ["REDIS_PORT"]
REDIS_SESSION_DB = int(environ["REDIS_SESSION_DB"])
CELERY_BROKER_URL = environ["CELERY_BROKER_URL"]
CELERY_RESULT_BACKEND = environ["CELERY_RESULT_BACKEND"]
class Development(Base):
"""The Development configuration."""
ENV = "development"
CELERY_ALWAYS_EAGER = True
DEBUG = True
DATA_DIR = Path(Base.PROJECT_ROOT) / "data"
class Testing(Base):
"""The testing configuration."""
ENV = "testing"
TESTING = True
class Production(Base):
"""The production configuration."""
ENV = "production"
DATA_DIR = "/data"
CONFIG = {
"development": Development,
"testing": Testing,
"production": Production,
}