Basic flask application with after_request returns server error

后端 未结 1 425
执念已碎
执念已碎 2021-01-21 18:47
from flask import Flask
app = Flask(__name__)
@app.route(\'/\')
def hello():    
    return \"k?\"
@app.after_request
def sendsms():
    pass
if __name__ == \'__main__\'         


        
1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-21 19:41

    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_request
    def sendsms(response):
        return response
    

    0 讨论(0)
提交回复
热议问题