2022-06-04 19:30:54 +03:00
|
|
|
import os
|
2022-06-04 16:01:23 +03:00
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
2022-06-11 23:34:55 +03:00
|
|
|
SECRET_KEY = "django-insecure-%_8sy196w4hzo9^cp9(@r=i+amh47r4mxfhq_(ok&=c(@%bhmk"
|
2022-06-05 13:09:27 +03:00
|
|
|
TOKEN_EXP = 2678400 # 31 day
|
2022-06-04 16:01:23 +03:00
|
|
|
DEBUG = True
|
|
|
|
|
|
|
|
ALLOWED_HOSTS = []
|
|
|
|
|
2022-07-02 14:57:58 +03:00
|
|
|
if DEBUG:
|
|
|
|
ALLOWED_HOSTS = ["*"]
|
|
|
|
|
2022-06-04 16:01:23 +03:00
|
|
|
INSTALLED_APPS = [
|
2022-06-25 12:36:47 +03:00
|
|
|
"django.contrib.sessions",
|
2022-06-11 23:34:55 +03:00
|
|
|
"django.contrib.auth",
|
|
|
|
"django.contrib.contenttypes",
|
2022-07-02 14:57:58 +03:00
|
|
|
"django.contrib.staticfiles",
|
2022-06-11 23:34:55 +03:00
|
|
|
"django.contrib.messages",
|
2022-06-04 19:30:54 +03:00
|
|
|
# Packages
|
|
|
|
"rest_framework",
|
2022-06-11 23:34:55 +03:00
|
|
|
"channels",
|
2022-06-04 19:30:54 +03:00
|
|
|
# Apps
|
2022-06-11 23:34:55 +03:00
|
|
|
"game",
|
2022-06-25 12:36:47 +03:00
|
|
|
"room",
|
2022-06-04 16:01:23 +03:00
|
|
|
]
|
|
|
|
|
2022-07-02 00:05:05 +03:00
|
|
|
|
2022-07-02 14:57:58 +03:00
|
|
|
TEMPLATES = [
|
|
|
|
{
|
2022-07-09 14:12:29 +03:00
|
|
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
|
|
"DIRS": [],
|
|
|
|
"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",
|
2022-07-02 14:57:58 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2022-06-04 16:01:23 +03:00
|
|
|
MIDDLEWARE = [
|
2022-06-11 23:34:55 +03:00
|
|
|
"django.middleware.security.SecurityMiddleware",
|
2022-06-21 20:26:32 +03:00
|
|
|
"django.contrib.sessions.middleware.SessionMiddleware",
|
2022-06-11 23:34:55 +03:00
|
|
|
"django.middleware.common.CommonMiddleware",
|
|
|
|
"django.middleware.csrf.CsrfViewMiddleware",
|
|
|
|
"django.contrib.messages.middleware.MessageMiddleware",
|
|
|
|
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
2022-06-04 16:01:23 +03:00
|
|
|
]
|
|
|
|
|
2022-06-11 23:34:55 +03:00
|
|
|
ROOT_URLCONF = "chess_backend.urls"
|
2022-06-04 16:01:23 +03:00
|
|
|
|
2022-06-21 11:36:55 +03:00
|
|
|
ASGI_APPLICATION = "chess_backend.asgi.application"
|
|
|
|
CHANNEL_LAYERS = {
|
|
|
|
"default": {
|
|
|
|
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
|
|
|
"CONFIG": {
|
|
|
|
"hosts": [("127.0.0.1", 6379)],
|
2022-06-04 16:01:23 +03:00
|
|
|
},
|
|
|
|
},
|
2022-06-21 11:36:55 +03:00
|
|
|
}
|
|
|
|
|
2022-06-25 12:36:47 +03:00
|
|
|
|
2022-06-11 23:34:55 +03:00
|
|
|
WSGI_APPLICATION = "chess_backend.wsgi.application"
|
2022-06-04 16:01:23 +03:00
|
|
|
|
|
|
|
|
|
|
|
DATABASES = {
|
2022-06-11 23:34:55 +03:00
|
|
|
"default": {
|
|
|
|
"ENGINE": "django.db.backends.sqlite3",
|
|
|
|
"NAME": BASE_DIR / "db.sqlite3",
|
2022-06-04 16:01:23 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-21 11:36:55 +03:00
|
|
|
LANGUAGES = [
|
|
|
|
("en-us", "English"),
|
|
|
|
("ru", "Russian"),
|
2022-06-04 16:01:23 +03:00
|
|
|
]
|
|
|
|
|
2022-06-21 11:36:55 +03:00
|
|
|
TIME_ZONE = "Europe/Moscow"
|
2022-06-04 16:01:23 +03:00
|
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
USE_TZ = True
|
|
|
|
|
2022-06-04 19:30:54 +03:00
|
|
|
MEDIA_URL = "/media/"
|
|
|
|
STATIC_URL = "/static/"
|
2022-06-04 16:01:23 +03:00
|
|
|
|
2022-06-04 19:30:54 +03:00
|
|
|
if DEBUG:
|
|
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, "media/")
|
|
|
|
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
|
|
|
|
else:
|
|
|
|
MEDIA_ROOT = "/var/www/media/"
|
|
|
|
STATIC_ROOT = "/var/www/static/"
|
2022-06-04 16:01:23 +03:00
|
|
|
|
2022-06-11 23:34:55 +03:00
|
|
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
2022-06-21 11:36:55 +03:00
|
|
|
|
|
|
|
LOGGING = {
|
|
|
|
"version": 1,
|
|
|
|
"disable_existing_loggers": False,
|
|
|
|
"handlers": {
|
|
|
|
"file": {
|
|
|
|
"level": "WARNING",
|
|
|
|
"class": "logging.FileHandler",
|
|
|
|
"filename": "debug.log",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"loggers": {
|
|
|
|
"django": {
|
|
|
|
"handlers": ["file"],
|
|
|
|
"level": "DEBUG",
|
|
|
|
"propagate": True,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|