我将Flask(0.11.1)与OpenERP一起使用,并且:
@app.route("/sync_order")
def sync_order():
print(1)
@app.route("/sync_order")
def sync_order():
print(1)
# override it
@app.route("/sync_order")
def sync_order2():
print(2)
AssertionError: View function mapping is overwriting an existing endpoint function: sync_order
@app.route("/sync_order")
def sync_order():
print(1)
def sync_order2():
print(2)
# change the mapping of endpoint and view functions
# print `2` now
with app.app_context() as context:
context.app.view_functions['sync_order'] = sync_order2
这是我的问题:
谢谢