diff --git a/dingxin_toolbox_drf/settings.py b/dingxin_toolbox_drf/settings.py index 196a454..c18af74 100644 --- a/dingxin_toolbox_drf/settings.py +++ b/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')] } }