Merge branch 'master' into 'Javascript-continious-upload-translate'

# Conflicts:
#   photo21/settings.py
This commit is contained in:
loulous27 2025-11-23 15:31:56 +01:00
commit 7a0bf9485b
5 changed files with 77 additions and 13 deletions

View file

@ -37,6 +37,11 @@ ALLOWED_HOSTS = [
"photos-dev.crans.org",
]
INTERNAL_IPS = [
"127.0.0.1",
"localhost",
]
# Admins receive server errors, this is useful to be notified of potential bugs
ADMINS = [
("admin", "photos-admin@lists.crans.org"),
@ -68,9 +73,12 @@ INSTALLED_APPS = [
"allauth_note_kfet",
"crispy_forms",
"photologue",
"photo21"
"photo21",
]
if DEBUG:
INSTALLED_APPS += ["debug_toolbar",] # For debug and optimisations
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
@ -81,8 +89,10 @@ MIDDLEWARE = [
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.contrib.sites.middleware.CurrentSiteMiddleware",
"allauth.account.middleware.AccountMiddleware",
"allauth.account.middleware.AccountMiddleware", # For the django =< 5.0
]
if DEBUG :
MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware",]
ROOT_URLCONF = "photo21.urls"
@ -122,6 +132,13 @@ DATABASES = {
}
}
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
"LOCATION": "Master",
}
}
# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators

View file

@ -14,6 +14,9 @@ from django.contrib import admin
from django.urls import include, path, re_path
from django.views.i18n import JavaScriptCatalog
if settings.DEBUG :
from debug_toolbar.toolbar import debug_toolbar_urls
from .views import IndexView, MediaAccess
urlpatterns = [
@ -29,6 +32,7 @@ urlpatterns = [
# In production media are served through NGINX with X-Accel-Redirect
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += debug_toolbar_urls()
else:
urlpatterns.append(
re_path("^media/(?P<path>.*)", MediaAccess.as_view(), name="media")