Python 连接到在我的pi上运行的flask应用程序
我用flask编写了一个web应用程序,它在我的pi上运行,例如:Python 连接到在我的pi上运行的flask应用程序,python,flask,raspberry-pi3,Python,Flask,Raspberry Pi3,我用flask编写了一个web应用程序,它在我的pi上运行,例如: from flask import Flask app = Flask(__name__) @app.route('/') def hello(): return 'Hello' app.run() 现在我想在我的windows笔记本电脑上运行另一个Python应用程序,它通过wifi向我的pi上的flask应用程序发送请求。我该怎么做?每次我尝试,我都会得到: Max retries exceeded with
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello'
app.run()
现在我想在我的windows笔记本电脑上运行另一个Python应用程序,它通过wifi向我的pi上的flask应用程序发送请求。我该怎么做?每次我尝试,我都会得到:
Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002C58FFB5198>: Failed to establish a new connection: [WinError 10061]
url:/(由NewConnectionError(':无法建立新连接引起)超过了最大重试次数:[WinError 10061]
我必须做些什么才能使这项工作正常进行?假设您的笔记本电脑可以正常访问Raspberry Pi,例如通过SSH,那么我怀疑Flask只是在本地监听
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello'
app.run(host='0.0.0.0') # Notice we are allowing outside connections here
谢谢!我以前也有过这个问题,但现在已经不记得了:D