142 lines
3.4 KiB
Python
142 lines
3.4 KiB
Python
"""
|
|
Django settings for borgweb project.
|
|
|
|
Generated by 'django-admin startproject' using Django 3.2.
|
|
|
|
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/
|
|
"""
|
|
import os
|
|
from pathlib import Path
|
|
from . import SECRET_KEY as __SECRET_KEY
|
|
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
SECRET_KEY = __SECRET_KEY
|
|
|
|
DEBUG = True
|
|
|
|
ALLOWED_HOSTS = ['127.0.0.1']
|
|
|
|
AXES_LOCKOUT_CALLABLE = "borg.views.axes"
|
|
|
|
# Application definition
|
|
|
|
AUTHENTICATION_BACKENDS = [
|
|
'axes.backends.AxesBackend',
|
|
'django.contrib.auth.backends.ModelBackend',
|
|
]
|
|
|
|
INSTALLED_APPS = [
|
|
'borg.apps.BorgConfig',
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'compressor',
|
|
'axes',
|
|
]
|
|
|
|
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',
|
|
'axes.middleware.AxesMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = 'borgweb.urls'
|
|
|
|
LOGIN_REDIRECT_URL = '/'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [str(BASE_DIR.joinpath('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 = 'borgweb.wsgi.application'
|
|
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': BASE_DIR / 'borg.sqlite',
|
|
}
|
|
}
|
|
|
|
|
|
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',
|
|
},
|
|
]
|
|
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
USE_TZ = False
|
|
|
|
|
|
STATICFILES_FINDERS = [
|
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
|
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
|
'compressor.finders.CompressorFinder'
|
|
]
|
|
COMPRESS_PRECOMPILERS = (('text/x-scss', 'django_libsass.SassCompiler'),)
|
|
|
|
COMPRESS_ENABLED = True
|
|
COMPRESS_OFFLINE = True
|
|
LIBSASS_OUTPUT_STYLE = 'compressed'
|
|
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
|
|
|
|
STATIC_URL = '/static/'
|
|
STATIC_ROOT = os.path.join(BASE_DIR, 'root')
|
|
STATICFILES_DIRS = [
|
|
os.path.join(BASE_DIR, 'static'),
|
|
]
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
|
|
# Cache
|
|
CACHES = {
|
|
'default': {
|
|
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
|
'LOCATION': 'unique-snowflake',
|
|
}
|
|
}
|