我认为你需要添加一个前缀http://或https://到"www.google.com“。否则Flask会将其视为应用内的相对网址。因此下面将是一个404,因为它将转到“ localhost:5000 / www.google.com”
@app.route('/test')def test(): return redirect("www.google.com")但是,如果尝试使用http://,它应该可以正常工作。
@app.route('/test')def test(): return redirect("http://www.google.com")


