采用Django4.0 + React18.2.0 + rest_framework
BUG1 redis缓存登录状态问题
CACHES = {
'default': {
'BACKEND': "django_redis.cache.RedisCache",
"LOCATION": "redis://localhost:6379/3", # TODO 3作为登录验证
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"CONNECTION_POOL_KWARGS": {"max_connections": 100}
}
}
}
django.core.cache.backends.base.InvalidCacheBackendError:
Could not find backend 'django_redis.cache.RedisCache':
cannot import name 'six' from 'django.utils'
(D:\anaconda\envs\my_world\lib\site-packages\django\utils\__init__.py)
问题为django-redis仅支持django2.2
解决方法:
CACHES = {
'default': {
'BACKEND': "django.core.cache.backends.redis.RedisCache",
"LOCATION": "redis://localhost:6379/3", # TODO 3作为登录验证
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"CONNECTION_POOL_KWARGS": {"max_connections": 100}
}
}
}
使用django内置redis缓存.
BUG2
就离谱
https://stackoverflow.com/questions/63690695/react-redirect-is-not-exported-from-react-router-dom/66985282