Base templates

This commit is contained in:
Alexandre Iooss 2021-09-22 19:32:04 +02:00
parent 76ed93ff33
commit 5610ade1fe
19 changed files with 426 additions and 2 deletions

View file

@ -32,11 +32,15 @@ ALLOWED_HOSTS = []
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'photologue',
'sortedm2m',
]
MIDDLEWARE = [
@ -47,6 +51,8 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.sites.middleware.CurrentSiteMiddleware',
]
ROOT_URLCONF = 'photo21.urls'
@ -54,7 +60,7 @@ ROOT_URLCONF = 'photo21.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [os.path.join(BASE_DIR, 'photo21/templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@ -62,6 +68,7 @@ TEMPLATES = [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
],
},
},
@ -113,8 +120,40 @@ USE_L10N = True
USE_TZ = True
# Limit available languages to this subset
from django.utils.translation import gettext_lazy as _
LANGUAGES = [
('de', _('German')),
('en', _('English')),
('es', _('Spanish')),
('fr', _('French')),
]
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'photo21/static'),
]
# Use /media/ for user uploaded media
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
MEDIA_URL = '/media/'
LOCALE_PATHS = [os.path.join(BASE_DIR, 'photo21/locale')]
FIXTURE_DIRS = [os.path.join(BASE_DIR, 'note_kfet/fixtures')]
# Mail will be sent from this address
SERVER_EMAIL = "photos@crans.org"
DEFAULT_FROM_EMAIL = f"Serveur photos <{SERVER_EMAIL}>"
# After login redirect user to transfer page
LOGIN_REDIRECT_URL = '/'
# An user session will expired after 3 hours
SESSION_COOKIE_AGE = 60 * 60 * 3
# Use only one Django Sites
SITE_ID = 1