78 lines
2 KiB
Python
78 lines
2 KiB
Python
from pathlib import Path
|
|
|
|
import requests
|
|
|
|
from config import tCOMMON_TOKEN, tCOMMON_URL_INTERNAL
|
|
|
|
config = requests.get(f"{tCOMMON_URL_INTERNAL}/api/initialize/", params={
|
|
"token": tCOMMON_TOKEN
|
|
}, allow_redirects=False).json()
|
|
|
|
if not config["success"]:
|
|
raise ImportError("tCommon token doesn't match")
|
|
|
|
if not config["services"]["message"]:
|
|
raise ImportError("tMessage isn't registered in tCommon")
|
|
|
|
DEBUG = config["debug"]
|
|
SECRET_KEY = config["services"]["message"]["token"]
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
ALLOWED_HOSTS = ["*"]
|
|
|
|
INSTALLED_APPS = [
|
|
"django.contrib.admin",
|
|
"django.contrib.auth",
|
|
"django.contrib.contenttypes",
|
|
"django.contrib.sessions",
|
|
"django.contrib.messages"
|
|
]
|
|
|
|
MIDDLEWARE = [
|
|
"django.middleware.security.SecurityMiddleware",
|
|
"django.contrib.sessions.middleware.SessionMiddleware",
|
|
"django.middleware.common.CommonMiddleware",
|
|
"django.middleware.csrf.CsrfViewMiddleware",
|
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
"django.contrib.messages.middleware.MessageMiddleware",
|
|
"django.middleware.clickjacking.XFrameOptionsMiddleware"
|
|
]
|
|
|
|
ROOT_URLCONF = "tmessage.urls"
|
|
|
|
TEMPLATES = [
|
|
{
|
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
"DIRS": [
|
|
BASE_DIR / "tmessage/templates"
|
|
],
|
|
"APP_DIRS": True,
|
|
"OPTIONS": {
|
|
"context_processors": [
|
|
"django.template.context_processors.debug",
|
|
"django.template.context_processors.request",
|
|
"django.contrib.auth.context_processors.auth",
|
|
"django.contrib.messages.context_processors.messages",
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = "tmessage.wsgi.application"
|
|
|
|
DATABASES = {
|
|
"default": {
|
|
"ENGINE": "django.db.backends.sqlite3",
|
|
"NAME": BASE_DIR / "message.sqlite3",
|
|
}
|
|
}
|
|
|
|
AUTH_PASSWORD_VALIDATORS = []
|
|
|
|
LANGUAGE_CODE = "en-us"
|
|
TIME_ZONE = "UTC"
|
|
USE_I18N = True
|
|
USE_TZ = True
|
|
|
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|