nk20/note_kfet/settings.py

157 lines
4.0 KiB
Python
Raw Normal View History

2019-07-08 09:08:07 +00:00
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
2019-07-07 20:49:02 +00:00
import os
2019-07-08 09:08:07 +00:00
from django.utils.translation import gettext_lazy as _
2019-07-07 20:49:02 +00:00
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
2019-07-08 09:08:07 +00:00
SECRET_KEY = 'CHANGE_ME_IN_LOCAL_SETTINGS!'
2019-07-07 20:49:02 +00:00
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
2019-07-08 09:08:07 +00:00
ADMINS = (
2019-07-08 12:22:41 +00:00
# ('Admin', 'webmaster@example.com'),
2019-07-08 09:08:07 +00:00
)
SITE_ID = 1
ALLOWED_HOSTS = []
2019-07-07 20:49:02 +00:00
# Application definition
INSTALLED_APPS = [
2019-07-08 11:51:15 +00:00
# Theme overrides Django Admin templates
'theme',
# Django contrib
2019-07-07 20:49:02 +00:00
'django.contrib.admin',
2019-07-08 09:08:07 +00:00
'django.contrib.admindocs',
2019-07-07 20:49:02 +00:00
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
2019-07-08 09:08:07 +00:00
'django.contrib.sites',
2019-07-07 20:49:02 +00:00
'django.contrib.messages',
'django.contrib.staticfiles',
2019-07-08 11:51:15 +00:00
2019-07-08 12:22:41 +00:00
# External apps
'guardian',
2019-07-08 11:51:15 +00:00
# Note apps
2019-07-16 10:43:23 +00:00
'activity',
'member',
2019-07-08 12:30:58 +00:00
'note',
2019-07-07 20:49:02 +00:00
]
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',
2019-07-08 09:08:07 +00:00
'django.contrib.admindocs.middleware.XViewMiddleware',
2019-07-07 20:49:02 +00:00
'django.middleware.clickjacking.XFrameOptionsMiddleware',
2019-07-08 09:08:07 +00:00
'django.middleware.locale.LocaleMiddleware',
'django.contrib.sites.middleware.CurrentSiteMiddleware',
2019-07-07 20:49:02 +00:00
]
ROOT_URLCONF = 'note_kfet.urls'
TEMPLATES = [
{
'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',
],
},
},
]
WSGI_APPLICATION = 'note_kfet.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/2.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',
},
]
2019-07-08 12:22:41 +00:00
# Django Guardian object permissions
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend', # this is default
'guardian.backends.ObjectPermissionBackend',
)
2019-07-07 20:49:02 +00:00
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
2019-07-08 09:16:29 +00:00
LANGUAGE_CODE = 'en'
2019-07-07 20:49:02 +00:00
2019-07-08 09:08:07 +00:00
LANGUAGES = [
2019-07-08 09:16:29 +00:00
('en', _('English')),
('fr', _('French')),
2019-07-08 09:08:07 +00:00
]
TIME_ZONE = 'Europe/Paris'
2019-07-07 20:49:02 +00:00
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
2019-07-08 09:08:07 +00:00
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
2019-07-07 20:49:02 +00:00
STATIC_URL = '/static/'
2019-07-08 09:08:07 +00:00
try:
2019-07-08 12:13:06 +00:00
from .settings_local import *
2019-07-08 09:08:07 +00:00
except ImportError:
pass