initial commit

This commit is contained in:
behruz-dev
2025-08-28 13:05:11 +05:00
commit 8ac8fd8787
58 changed files with 783 additions and 0 deletions

6
config/conf/__init__.py Normal file
View File

@@ -0,0 +1,6 @@
from .rest_framework import *
from .cors import *
from .jwt import *
from .logs import *
from .swagger import *
from .redis import *

9
config/conf/cors.py Normal file
View File

@@ -0,0 +1,9 @@
CORS_ALLOWED_ORIGINS = [
"http://localhost:5173",
"http://127.0.0.1:5173",
]
CSRF_TRUSTED_ORIGINS = [
'http://localhost:8001',
'http://127.0.0.1:8001',
]

10
config/conf/jwt.py Normal file
View File

@@ -0,0 +1,10 @@
from datetime import timedelta
SIMPLE_JWT = {
"ACCESS_TOKEN_LIFETIME": timedelta(days=30),
"REFRESH_TOKEN_LIFETIME": timedelta(days=365),
"ROTATE_REFRESH_TOKENS": True,
"BLACKLIST_AFTER_ROTATION": True,
"UPDATE_LAST_LOGIN": True,
}

0
config/conf/logs.py Normal file
View File

24
config/conf/redis.py Normal file
View File

@@ -0,0 +1,24 @@
CACHES = {
"default": {
"BACKEND": 'django_redis.cache.RedisCache',
"LOCATION": 'redis://redis:6379',
"TIMEOUT": 300,
},
}
CACHE_MIDDLEWARE_SECONDS = 300
CACHEOPS_REDIS = 'redis://redis:6379'
CACHEOPS_DEFAULTS = {
"timeout": 300,
}
CACHEOPS = {
"accounts.*": {
"ops": "all",
"timeout": 60 * 5,
},
}
CACHEOPS_DEGRADE_ON_FAILURE = True
CACHEOPS_ENABLED = False

View File

@@ -0,0 +1,9 @@
REST_FRAMEWORK = {
"DEFAULT_AUTHENTICATION_CLASSES": [
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication',
'rest_framework_simplejwt.authentication.JWTAuthentication',
],
# 'DEFAULT_PAGINATION_CLASS': 'core.apps.shared.paginations.custom.CustomPageNumberPagination',
# 'PAGE_SIZE': 10
}

13
config/conf/swagger.py Normal file
View File

@@ -0,0 +1,13 @@
SWAGGER_SETTINGS = {
'SECURITY_DEFINITIONS': {
'Basic': {
'type': 'basic'
},
'Bearer': {
'type': 'apiKey',
'name': 'Authorization',
'in': 'header'
}
},
"USE_SESSION_AUTH": False
}