Caches é SQL optimisations
This commit is contained in:
parent
213644d0af
commit
f1673da45f
5 changed files with 69 additions and 14 deletions
|
|
@ -28,7 +28,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|||
SECRET_KEY = "CHANGE ME"
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = [
|
||||
"127.0.0.1",
|
||||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ from django.conf import settings
|
|||
from django.conf.urls.static import static
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path, re_path
|
||||
from debug_toolbar.toolbar import debug_toolbar_urls
|
||||
|
||||
from .views import IndexView, MediaAccess
|
||||
|
||||
|
|
@ -27,6 +28,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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue