backend/config/settings.py

169 lines
4.2 KiB
Python
Raw Normal View History

2021-10-28 10:12:20 +00:00
"""
Django settings for config project.
Generated by 'django-admin startproject' using Django 3.2.8.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib import Path
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-z465dl_(vk55hxbm0bj*mp-ok3!*=ssw#!$5s2nrxa!9j+67z+'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
2022-05-20 17:14:48 +00:00
ALLOWED_HOSTS = ['server.riezel.com', 'localhost', '127.0.0.1', '192.168.1.244']
2021-10-28 10:12:20 +00:00
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
2022-05-20 17:14:48 +00:00
# third-party
'channels', # as high as possible (channels overloads 'runserver', may conflict with e.g. whitenoise)
'rest_framework',
'corsheaders',
'drf_yasg',
'django_tex',
2021-10-28 10:12:20 +00:00
# local
'accounts',
2022-05-20 17:14:48 +00:00
'photo_log',
'api',
2021-10-28 10:12:20 +00:00
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
2022-05-20 17:14:48 +00:00
'corsheaders.middleware.CorsMiddleware',
2021-10-28 10:12:20 +00:00
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
2022-05-20 17:14:48 +00:00
CORS_ALLOWED_ORIGINS = [
'http://localhost:3000',
'http://localhost:8080',
'http://192.168.1.244:8080',
]
2021-10-28 10:12:20 +00:00
ROOT_URLCONF = 'config.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, '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',
],
},
},
2022-05-20 17:14:48 +00:00
{
'NAME': 'tex',
'BACKEND': 'django_tex.engine.TeXEngine',
'APP_DIRS': True,
'DIRS': [os.path.join(BASE_DIR, 'templates/')],
},
2021-10-28 10:12:20 +00:00
]
2022-05-20 17:14:48 +00:00
LATEX_INTERPRETER = 'xelatex'
TEMPLATE_DIRS = (
os.path.join(BASE_DIR, 'templates'),
)
2021-10-28 10:12:20 +00:00
WSGI_APPLICATION = 'config.wsgi.application'
2022-05-20 17:14:48 +00:00
ASGI_APPLICATION = 'config.asgi.application'
2021-10-28 10:12:20 +00:00
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'www_db',
'USER': 'www_db_user',
'PASSWORD': 'UI&hWG,El7G{A2c0n=qIULv:b',
'HOST': 'localhost',
'PORT': '5432',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
AUTH_USER_MODEL = 'accounts.CustomUser'
# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
2022-05-20 17:14:48 +00:00
#STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/")]
2021-10-28 10:12:20 +00:00
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'