尝试将两个参数从烧瓶中的 html 形式(在 url 中)传递到 python 程序中的 运行

Trying to pass two parameters from an html form in flask (in url) to then run in a python program

我对此很陌生,我有一个 python 算法,我想 运行 使用从 html 表单中获得的两个参数。这是我的 html 代码:

<form action="result/">
      <p><input class="w3-input w3-padding-16" method = "post" type="text" placeholder="Playlist URI" required name="URI"></p>
      <p><input class="w3-input w3-padding-16" method = "post" type="text" placeholder="Spotify Username" required name="Username"></p>
      <p>
        <button class="w3-button w3-light-grey w3-padding-large" type="submit">
          <i class="fa fa-paper-plane"></i> Submit
        </button>
      </p>
    </form>

当我在表单中输入 b 和 c 时,它会将我重定向到 http://127.0.0.1:5000/result/?URI=b&Username=c

不过我不知道如何接受它们作为参数,只是 returns 这个错误:

404 Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

我的 python 代码如下所示:

@app.route('/result.html/<URI>&<username>')
def result(URI,username):
    return render_template("result.html", uri=URI, username=username)

您可以使用 flask 中的请求访问 get 请求中的参数

示例:

from flask import Flask, request

app = Flask(__name__)

@app.route("/result.html")
def result():
    uri = request.args.get("uri")
    username = request.args.get("username")