From 61228b118ca7114d26d8f77846cbcdfcc0dec5ab Mon Sep 17 00:00:00 2001 From: RogerWork Date: Tue, 21 May 2024 14:43:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dingxin_toolbox_drf/settings.py | 12 +++++++----- mock/views.py | 8 ++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/dingxin_toolbox_drf/settings.py b/dingxin_toolbox_drf/settings.py index f80a8fe..48ec555 100644 --- a/dingxin_toolbox_drf/settings.py +++ b/dingxin_toolbox_drf/settings.py @@ -27,7 +27,8 @@ print(BASE_DIR) # # SERVER_IP = '' CONFIG = { 'dev': { - 'SERVER_IP': '172.16.1.63', + 'SERVER_IP': '172.16.1.114', + 'WEB_SERVER_IP': '172.16.1.114', 'DB': { "HOST": 'home.rogersun.cn', "PORT": 3306, @@ -35,18 +36,19 @@ CONFIG = { "PASSWORD": "cine123456", "NAME": "dingxin_toolbox", }, - 'REDIS_IP': '172.16.1.63' + 'REDIS_IP': '172.16.1.114' }, 'prd': { - 'SERVER_IP': '172.16.1.222', + 'SERVER_IP': '172.16.1.63', + 'WEB_SERVER_IP': '172.16.1.222', 'DB': { - "HOST": '172.16.1.222', + "HOST": '172.16.1.63', "PORT": 3306, "USER": "dingxin", "PASSWORD": "cine123456", "NAME": "dingxin_toolbox", }, - 'REDIS_IP': '172.16.1.222' + 'REDIS_IP': '172.16.1.63' } } diff --git a/mock/views.py b/mock/views.py index 627f216..ee9d0d3 100644 --- a/mock/views.py +++ b/mock/views.py @@ -216,8 +216,8 @@ def get_response(request): # 获取本机 IP 地址: def get_local_ip(): - ip = CONFIG[ENV]['SERVER_IP'] - if CONFIG[ENV]['SERVER_IP'] == '': + ip = CONFIG[ENV]['WEB_SERVER_IP'] + if CONFIG[ENV]['WEB_SERVER_IP'] == '': r = runserver() ip = socket.gethostbyname(socket.gethostname()) print(ip) @@ -272,11 +272,11 @@ def enable_mock(request): server_ip = get_local_ip() current_host = db(ip, GET_ZZ_PLATFORM_HOST_SQL)['data'][0]['cinema_common_info_val'] if current_host == 'https://zzcs.yinghezhong.com' or current_host == 'https://dy.yinghezhong.com': - db_result = db(ip, UPDATE_ZZ_PLATFORM_HOST_SQL, (f'http://{server_ip}:8000',)) + db_result = db(ip, UPDATE_ZZ_PLATFORM_HOST_SQL, (f'http://{server_ip}',)) if db_result['result'] > 0: ZZMockModel.objects.filter(ip=ip).update(**mock_config) return JsonResponse({'status': 'success'}) - if current_host == f'http://{server_ip}:8000': + if current_host == f'http://{server_ip}': ZZMockModel.objects.filter(ip=ip).update(**mock_config) return JsonResponse({'status': 'success'}) return JsonResponse({'status': 'fail'})