Refactor database models to majorly increase queries needed and decrease load times of home from 30 secs to 5 sec (we will be caching the rest to decrease even further via background tasks)

This commit is contained in:
badblocks 2025-03-17 14:08:01 -07:00
parent f7a9b2f823
commit 86c7eba10a
25 changed files with 1941 additions and 1560 deletions

View file

@ -47,7 +47,7 @@ INSTALLED_APPS = [
'allauth.socialaccount.providers.google',
"crispy_forms",
"crispy_tailwind",
#"debug_toolbar",
"debug_toolbar",
"el_pagination",
"tailwind",
"theme",
@ -56,7 +56,7 @@ INSTALLED_APPS = [
"cards",
"home",
"trades.apps.TradesConfig",
"silk",
#"silk",
]
SILKY_PYTHON_PROFILER = True
@ -73,13 +73,13 @@ MIDDLEWARE = [
"whitenoise.middleware.WhiteNoiseMiddleware", # WhiteNoise
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
#"debug_toolbar.middleware.DebugToolbarMiddleware", # Django Debug Toolbar
"debug_toolbar.middleware.DebugToolbarMiddleware", # Django Debug Toolbar
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"allauth.account.middleware.AccountMiddleware", # django-allauth
'silk.middleware.SilkyMiddleware',
#'silk.middleware.SilkyMiddleware',
"django_browser_reload.middleware.BrowserReloadMiddleware",
#"django_project.middleware.AutoLoginMiddleware",
]
@ -299,6 +299,6 @@ else:
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.db.DatabaseCache",
"LOCATION": "django_site_cache",
"LOCATION": "site-cache",
}
}