Skip to content Skip to sidebar Skip to footer

Basic Flask Application With After_request Returns Server Error

from flask import Flask app = Flask(__name__) @app.route('/') def hello(): return 'k?' @app.after_request def sendsms(): pass if __name__ == '__main__': app.run()

Solution 1:

The documentation is usually a good place to find answers to things like this.

Your function must take one parameter, a response_class object and return a new response object or the same (see process_response()).

Your function does neither of those things.

@app.after_requestdefsendsms(response):
    return response

Post a Comment for "Basic Flask Application With After_request Returns Server Error"