from flask import *
from flask_restful import *
import sqlite3
import database
@app.route('/admin')
def admin():
""" hanldes the admin page for user entry """
db = database.database()
db.create()
db.table('admin')
#data = db.print_database('admin')
#return render_template ("mylogin.html", input = 'admin', dbs = data.fetchall())
return render_template ("mylogin.html", input = 'admin')
@app.route('/admin', methods = ["POST"])
def admin_post():
""" hanldes the admin page for user entry """
print "handling post"
return request.form['text']
if __name__ == "__main__":
app.run(debug=True)
HTML代码:我没有把整个代码张贴在这里,因为我没有偏离我所面临的问题。我可以打开/admin页面,当我给出输入时,得到一个错误“Method is not allowed for the required URL”
^{pr2}$
将html更改为:
基本上,发送表单的功能只接受您的请求。在
您需要将您的表单发布到管理帖子功能,该功能接受post请求。在
相关问题 更多 >
编程相关推荐