packagelarni ornatib sozlab chiqish kerak #2: issue bajarildi

This commit is contained in:
behruz-dev
2025-11-19 17:18:16 +05:00
parent 6025b296ad
commit 172e2d23c0
9 changed files with 156 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
from .djangorestframework import *
from .simple_jwt import *
from .jazzmin import *
from .cors_headers import *
from .redis import *

View File

@@ -0,0 +1,4 @@
from config.env import env
CORS_ALLOWED_ORIGINS = env.list('CORS_ALLOWED_ORIGINS')
CSRF_TRUSTED_ORIGINS = env.list('CSRF_TRUSTED_ORIGINS')

View File

@@ -0,0 +1,7 @@
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication'
'rest_framework_simplejwt.authentication.JWTAuthentication',
],
}

44
config/conf/jazzmin.py Normal file
View File

@@ -0,0 +1,44 @@
JAZZMIN_SETTINGS = {
"site_title": "Quruvchi Boshqaruv",
"site_header": "Quruvchi Boshqaruv",
"site_brand": "Quruvchi Boshqaruv",
"site_logo": None,
"login_logo": None,
"login_logo_dark": None,
"site_logo_classes": "img-circle",
"site_icon": None,
"welcome_sign": "Welcome to the Quruvchi Boshqaruv",
"copyright": "Quruvchi Boshqaruv",
"search_model": [],
"topmenu_links": [
{"name": "Home", "url": "admin:index", "permissions": ["auth.view_user"]},
{"name": "Support", "url": "https://github.com/farridav/django-jazzmin/issues", "new_window": True},
{"model": "auth.User"},
{"app": "books"},
],
"usermenu_links": [
{"name": "Support", "url": "https://github.com/farridav/django-jazzmin/issues", "new_window": True},
{"model": "auth.user"}
],
"show_sidebar": True,
"navigation_expanded": True,
"hide_apps": [],
"hide_models": ['auth.group'],
"order_with_respect_to": [],
"custom_links": {
},
"icons": {
"auth": "fas fa-users-cog",
"auth.user": "fas fa-user",
"auth.Group": "fas fa-users",
},
"default_icon_parents": "fas fa-chevron-circle-right",
"default_icon_children": "fas fa-circle",
"related_modal_active": False,
"custom_css": None,
"custom_js": None,
"use_google_fonts_cdn": True,
"show_ui_builder": False,
"changeform_format": "collapsible",
"language_chooser": True,
}

27
config/conf/simple_jwt.py Normal file
View File

@@ -0,0 +1,27 @@
from datetime import timedelta
from django.conf import settings
SIMPLE_JWT = {
"ACCESS_TOKEN_LIFETIME": timedelta(days=2),
"REFRESH_TOKEN_LIFETIME": timedelta(days=60),
"ROTATE_REFRESH_TOKENS": True,
"BLACKLIST_AFTER_ROTATION": True,
"UPDATE_LAST_LOGIN": True,
"ALGORITHM": "HS256",
"SIGNING_KEY": settings.SECRET_KEY,
"AUTH_HEADER_TYPES": ("Bearer",),
"AUTH_HEADER_NAME": "HTTP_AUTHORIZATION",
"USER_ID_FIELD": "id",
"USER_ID_CLAIM": "user_id",
"TOKEN_OBTAIN_SERIALIZER": "rest_framework_simplejwt.serializers.TokenObtainPairSerializer",
"TOKEN_REFRESH_SERIALIZER": "rest_framework_simplejwt.serializers.TokenRefreshSerializer",
"TOKEN_VERIFY_SERIALIZER": "rest_framework_simplejwt.serializers.TokenVerifySerializer",
"TOKEN_BLACKLIST_SERIALIZER": "rest_framework_simplejwt.serializers.TokenBlacklistSerializer",
"SLIDING_TOKEN_OBTAIN_SERIALIZER": "rest_framework_simplejwt.serializers.TokenObtainSlidingSerializer",
"SLIDING_TOKEN_REFRESH_SERIALIZER": "rest_framework_simplejwt.serializers.TokenRefreshSlidingSerializer",
}