我已经查看了一些示例和教程,据我所知,我有正确的观点。通过下面的基本示例,我收到以下错误:TypeError: view() got an unexpected keyword argument 'id'
from flask import Blueprint, jsonify
location_app = Blueprint('location_app', __name__)
@location_app.route('/location/', defaults={'id': '0'})
@location_app.route('/location/<id>', methods=['GET'])
def view():
return "location view"
答案 0 :(得分:0)
您的函数必须采用url定义的变量。像这样:
@location_app.route('/location/<id>', methods=['GET'])
def view(id):
return "location view"