优化REDIS_IP

main
RogerWork 9 months ago
parent 9dee6c74b9
commit 4311a867c0
  1. 5
      dingxin_toolbox_drf/settings.py

@ -20,6 +20,7 @@ print(BASE_DIR)
# 服务器IP
SERVER_IP = '172.16.1.63'
REDIS_IP = '172.16.1.63'
# SERVER_IP = ''
# Quick-start development settings - unsuitable for production
@ -104,7 +105,7 @@ CACHES = {
"default": {
'BACKEND': 'django_redis.cache.RedisCache',
# "BACKEND": "django.core.cache.backends.redis.RedisCache",
"LOCATION": "redis://127.0.0.1:6379",
"LOCATION": f"redis://{REDIS_IP}:6379",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
@ -224,7 +225,7 @@ CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [("127.0.0.1", 6379)],
"hosts": [(REDIS_IP, 6379)],
# "hosts": [os.environ.get('REDIS_URL', 'redis://127.0.0.1:6379/1')]
}
}

Loading…
Cancel
Save