我在网上找到的答案是使用request.args.get
. 但是,我无法让它工作。我有以下简单的例子:
from flask import Flask
app = Flask(__name__)
@app.route("/hello")
def hello():
print request.args['x']
return "Hello World!"
if __name__ == "__main__":
app.run()
我127.0.0.1:5000/hello?x=2
在浏览器中访问,结果我得到:
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
我究竟做错了什么?