Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 当我已经在虚拟环境中使用django运行API端点时,如何部署tabpy代码?_Python - Fatal编程技术网

Python 当我已经在虚拟环境中使用django运行API端点时,如何部署tabpy代码?

Python 当我已经在虚拟环境中使用django运行API端点时,如何部署tabpy代码?,python,Python,我正在尝试使用python中的django和R中的RestServe创建一个api端点,并在tabpy中部署下面的代码以连接tableau,我遇到了这个错误。有人能推荐任何解决方案吗 错误消息: ConnectionError:HTTPConnectionPool(主机=127.0.0.1',端口=9004):最大值 url:/endpoints超过重试次数(由 NewConnectionError(':未能建立新连接:[WinError] 10061]无法建立连接,因为目标计算机处于活动状态

我正在尝试使用python中的django和R中的RestServe创建一个api端点,并在tabpy中部署下面的代码以连接tableau,我遇到了这个错误。有人能推荐任何解决方案吗

错误消息:

ConnectionError:HTTPConnectionPool(主机=127.0.0.1',端口=9004):最大值 url:/endpoints超过重试次数(由 NewConnectionError(':未能建立新连接:[WinError] 10061]无法建立连接,因为目标计算机处于活动状态 拒绝)()

代码:

提前谢谢

import tabpy_client
import requests
client = tabpy_client.Client('http://127.0.0.1:9004')

def external_services_say_hello(message, service):
    if service == 'PYTHON':
        r = requests.post('http://127.0.0.1:8000/', data ={'message': message})
    elif service == 'R':
        r = requests.post('http://localhost:8080/hello', data = {'message': message,})
 
    serviceResult = r.json()
    return serviceResult['result']

client.deploy('external_services_say_hello', external_services_say_hello, 'Make Python or R say Hello or anything you want.', override = True)
print('*** Model deployed successfully ***')