add cacheops and unfold for django admin
This commit is contained in:
@@ -9,3 +9,28 @@ CACHES = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CACHE_MIDDLEWARE_SECONDS = env("CACHE_TIMEOUT")
|
||||||
|
|
||||||
|
CACHEOPS_REDIS = env.str("REDIS_URL")
|
||||||
|
CACHEOPS_DEFAULTS = {
|
||||||
|
"timeout": env.str("CACHE_TIMEOUT"),
|
||||||
|
}
|
||||||
|
CACHEOPS = {
|
||||||
|
# !NOTE: api => "you app name"
|
||||||
|
"accounts.*": {
|
||||||
|
"ops": "all", # Barcha turdagi so'rovlarni keshga olish
|
||||||
|
"timeout": 60 * 5, # 5 daqiqa davomida saqlash
|
||||||
|
},
|
||||||
|
"shared.*": {
|
||||||
|
"ops": "all", # Barcha turdagi so'rovlarni keshga olish
|
||||||
|
"timeout": 60 * 5, # 5 daqiqa davomida saqlash
|
||||||
|
},
|
||||||
|
"contract.*": {
|
||||||
|
"ops": "all", # Barcha turdagi so'rovlarni keshga olish
|
||||||
|
"timeout": 60 * 5, # 5 daqiqa davomida saqlash
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
CACHEOPS_DEGRADE_ON_FAILURE = True
|
||||||
|
CACHEOPS_ENABLED = env.bool("CACHE_ENABLED", False)
|
||||||
31
config/conf/unfold.py
Normal file
31
config/conf/unfold.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
UNFOLD = {
|
||||||
|
"DASHBOARD_CALLBACK": "django_core.views.dashboard_callback",
|
||||||
|
"SITE_TITLE": None,
|
||||||
|
"SHOW_LANGUAGES": True,
|
||||||
|
"SITE_HEADER": None,
|
||||||
|
"SITE_URL": "/",
|
||||||
|
"SITE_SYMBOL": "speed", # symbol from icon set
|
||||||
|
"SHOW_HISTORY": True, # show/hide "History" button, default: True
|
||||||
|
"SHOW_VIEW_ON_SITE": True,
|
||||||
|
"COLORS": {
|
||||||
|
"primary": {
|
||||||
|
"50": "220 255 230",
|
||||||
|
"100": "190 255 200",
|
||||||
|
"200": "160 255 170",
|
||||||
|
"300": "130 255 140",
|
||||||
|
"400": "100 255 110",
|
||||||
|
"500": "70 255 80",
|
||||||
|
"600": "50 225 70",
|
||||||
|
"700": "40 195 60",
|
||||||
|
"800": "30 165 50",
|
||||||
|
"900": "20 135 40",
|
||||||
|
"950": "10 105 30",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"SIDEBAR": {
|
||||||
|
"show_search": True, # Search in applications and models names
|
||||||
|
"show_all_applications": True,
|
||||||
|
},
|
||||||
|
"SHOW_LANGUAGES": False,
|
||||||
|
}
|
||||||
@@ -27,6 +27,14 @@ DJANGO_APPS = [
|
|||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
DJANGO_UNFOLD = [
|
||||||
|
"unfold",
|
||||||
|
"unfold.contrib.filters",
|
||||||
|
"unfold.contrib.forms",
|
||||||
|
"unfold.contrib.guardian",
|
||||||
|
"unfold.contrib.simple_history",
|
||||||
|
]
|
||||||
|
|
||||||
APPS = [
|
APPS = [
|
||||||
'core.apps.shared',
|
'core.apps.shared',
|
||||||
'core.apps.accounts',
|
'core.apps.accounts',
|
||||||
@@ -37,9 +45,11 @@ PACKAGES = [
|
|||||||
'drf_spectacular',
|
'drf_spectacular',
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'rest_framework_simplejwt',
|
'rest_framework_simplejwt',
|
||||||
|
'cacheops',
|
||||||
]
|
]
|
||||||
|
|
||||||
INSTALLED_APPS = []
|
INSTALLED_APPS = []
|
||||||
|
INSTALLED_APPS += DJANGO_UNFOLD
|
||||||
INSTALLED_APPS += DJANGO_APPS
|
INSTALLED_APPS += DJANGO_APPS
|
||||||
INSTALLED_APPS += PACKAGES
|
INSTALLED_APPS += PACKAGES
|
||||||
INSTALLED_APPS += APPS
|
INSTALLED_APPS += APPS
|
||||||
@@ -141,3 +151,4 @@ from config.conf.rest_framework import *
|
|||||||
from config.conf.simplejwt import *
|
from config.conf.simplejwt import *
|
||||||
from config.conf.celery import *
|
from config.conf.celery import *
|
||||||
from config.conf.redis import *
|
from config.conf.redis import *
|
||||||
|
from config.conf.unfold import *
|
||||||
@@ -13,3 +13,5 @@ redis==6.2.0
|
|||||||
django-redis==6.0.0
|
django-redis==6.0.0
|
||||||
pytest
|
pytest
|
||||||
pytest-django
|
pytest-django
|
||||||
|
django-cacheops==7.2
|
||||||
|
django-unfold==0.62.0
|
||||||
Reference in New Issue
Block a user