展开全部
GET方式from flask import Flask, render_template, request
# Initialize the Flask application
app = Flask(__name__)
# This is a catch all route, to catch any request the user does
@app.route('/')
def index():
qs = request.query_string
return render_template('index.html', query_string=qs)
if __name__ == '__main__':
app.run(
host="0.0.0.0",
port=int("80"),
)
POST方式from flask import request
@app.route('/login', methods=['POST', 'GET'])
def login():
error = None
if request.method == 'POST':
if valid_login(request.form['username'],
request.form['password']):
return log_the_user_in(request.form['username'])
else:
error = 'Invalid username/password'
# the code below is executed if the request method
# was GET or the credentials were invalid
return render_template('login.html', error=error)
当然这些官方的开发文档都32313133353236313431303231363533e4b893e5b19e31333339653831有的