Python/Flask: ValueError: View function did not return a response -
seemingly trivial problem can't figure out, despite going through documentation , tutorial. keeps on coughing up:
builtins.valueerror valueerror: view function did not return response
whenever try render template. using pycharm editor doesn't warn problems.
website.py:
from flask import flask, url_for, request, render_template app = flask(__name__, template_folder='templates') @app.route('/') def hello_world(): render_template('hello_world.html') if __name__ == '__main__': app.debug = true app.run()
hello_world.html:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>hello, flask</title> </head> <body> <h1>hello, world , flask!</h1> </body> </html>
should of course have been
@app.route('/') def hello_world(): return render_template('hello_world.html')
overlooked 'return' when inserting render_template.
Comments
Post a Comment