I'm in the middle of developing a Python app and using flask, and this is my DELETE function:
@app.route('/DeleteMessage', methods=['DELETE'])
def DeleteMessage():
messages = Message.query.all()
application_id = request.args.get('application_id')
if application_id:
messages.filter_by(user_id=application_id)
session_id = request.args.get('session_id')
if session_id:
messages.filter_by(session_id=session_id)
message_id = request.args.get('message_id')
if message_id:
messages = message.filter_by(message_id=message_id)
db.session.delete(messages)
db.session.commit()
return 'ok'
When I try to run it, it sends me such an error message:
Method Not Allowed
The method is not allowed for the requested URL.