a lot of changes

This commit is contained in:
behruz-dev
2025-08-05 09:27:06 +05:00
parent 4550e00618
commit 09e725834f
4 changed files with 17 additions and 6 deletions

View File

@@ -1,17 +1,17 @@
CACHES = { CACHES = {
"default": { "default": {
"BACKEND": 'django_redis.cache.RedisCache', "BACKEND": 'django_redis.cache.RedisCache',
"LOCATION": 'redis://127.0.0.1:6379/1', "LOCATION": 'redis://redis:6379',
"TIMEOUT": 5, "TIMEOUT": 300,
}, },
} }
CACHE_MIDDLEWARE_SECONDS = 5 CACHE_MIDDLEWARE_SECONDS = 300
CACHEOPS_REDIS = 'redis://127.0.0.1:6379/1' CACHEOPS_REDIS = 'redis://redis:6379'
CACHEOPS_DEFAULTS = { CACHEOPS_DEFAULTS = {
"timeout": 5, "timeout": 300,
} }
CACHEOPS = { CACHEOPS = {
@@ -23,6 +23,10 @@ CACHEOPS = {
"ops": "all", "ops": "all",
"timeout": 60 * 5 "timeout": 60 * 5
}, },
"company.Company":{
"ops": "all",
"timeout": 300,
},
"products.*": { "products.*": {
"ops": "all", "ops": "all",
"timeout": 60 * 5 "timeout": 60 * 5
@@ -42,4 +46,4 @@ CACHEOPS = {
} }
CACHEOPS_DEGRADE_ON_FAILURE = True CACHEOPS_DEGRADE_ON_FAILURE = True
CACHEOPS_ENABLED = False CACHEOPS_ENABLED = True

View File

@@ -35,6 +35,8 @@ PACKAGES = [
'rest_framework', 'rest_framework',
'rest_framework_simplejwt', 'rest_framework_simplejwt',
'corsheaders', 'corsheaders',
'cacheops',
# 'silk',
] ]
DJANGO_APPS = [ DJANGO_APPS = [
@@ -62,6 +64,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
# 'silk.middleware.SilkyMiddleware',
] ]
ROOT_URLCONF = 'config.urls' ROOT_URLCONF = 'config.urls'

View File

@@ -33,3 +33,4 @@ urlpatterns = [
# Media and Static Files # Media and Static Files
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += [path('silk/', include('silk.urls', namespace='silk'))]

View File

@@ -11,11 +11,14 @@ django-cacheops==7.2
django-cors-headers==4.7.0 django-cors-headers==4.7.0
django-environ==0.12.0 django-environ==0.12.0
django-jazzmin==3.0.1 django-jazzmin==3.0.1
django-modeltranslation==0.19.16
django-redis==6.0.0 django-redis==6.0.0
django-silk==5.4.0
djangorestframework==3.16.0 djangorestframework==3.16.0
djangorestframework_simplejwt==5.5.1 djangorestframework_simplejwt==5.5.1
drf-yasg==1.21.10 drf-yasg==1.21.10
funcy==2.0 funcy==2.0
gprof2dot==2025.4.14
gunicorn==23.0.0 gunicorn==23.0.0
h11==0.16.0 h11==0.16.0
inflection==0.5.1 inflection==0.5.1