I have no idea how to fix this problem that I get from my Python code when I am using Flask:
@app.route(\'/addEvent/\', methods=[\'POST\'])
def addEvent():
@app
Rename the second function; it too is called addEvent
; I suggest deleteEvent
instead:
@app.route('/deleteEvent/', methods=['POST'])
def deleteEvent():
The endpoint name is normally taken from the function you decorated with @app.route()
; you can also explicitly give your endpoint a different name by telling the decorator what name you'd want to use instead:
@app.route('/deleteEvent/', methods=['POST'], endpoint='deleteEvent')
def addEvent():
which would let you stick to using the same name for the function. In this specific case, that's not a good idea, because one function replaced the other and the only reference left to the first is in the Flask URL map.
Also see the Flask.route() documentation:
endpoint – the endpoint for the registered URL rule. Flask itself assumes the name of the view function as endpoint.