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
Raw Normal View History

2020-07-04 11:12:31 +00:00
"""The Application settings."""
from os import environ, pardir
from os.path import abspath, dirname, join
from pathlib import Path
2020-07-04 11:12:31 +00:00
class Base:
"""The base configuration."""
DEBUG = False
JSON_AS_ASCII = False
SECRET_KEY = environ["SECRET_KEY"]
2020-07-04 11:12:31 +00:00
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"
2020-07-04 11:12:31 +00:00
class Testing(Base):
"""The testing configuration."""
ENV = "testing"
TESTING = True
2020-07-04 11:12:31 +00:00
class Production(Base):
"""The production configuration."""
ENV = "production"
DATA_DIR = "/data"
2020-07-04 11:12:31 +00:00
CONFIG = {
"development": Development,
"testing": Testing,
"production": Production,
}