I'm rather new to web programming and Flask, and I've recently run into a problem with a website I am trying to create. I currently have a jquery procedure which sends a post request to a view function in Flask. This function simply increments a value in my database, and it's not really necessary for me to return a response after incrementing this value. However, as far as I've seen, view functions in Flask are required to return a Response object. I could of course trivially return some sort of json "was-updated" response, but it's really not important to my application. Does anyone know if the proper way to resolve this issue? Thanks.
It's quite simple, just return an empty string with 204 status code:
@app.route('/')
def hello():
# ...
return '', 204
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With