我正试图从flask中的列表中编写一个简单的下拉菜单。 由于某种原因,下拉列表为空。。。我将感谢所有提示:-)
app.py(片段)
@app.route("/getLigand", methods=["GET","POST"])
def dropdown():
colours = ["Red", "Blue", "Black", "Orange"]
return render_template("run_ligand.html", colours=colours)
运行\u ligand.html(片段)
<form name="Item_1" action="/getLigand" method="POST">
<label for="exampleFormControlFile2">Choose colour</label>
<select name=colours>
{% for colour in colours %}
<option value="{{colour}}" SELECTED>{{colour}}</option>
{% endfor %}
</select>
</form>
下拉列表不为空。检查您是否位于route方法中设置的右端点(http://localhost:5000/getLigand)
app.py
run_.html
相关问题 更多 >
编程相关推荐