# A very simple Flask Hello World app for you to get started with...fromflaskimportFlask,requestimportrequestsapp=Flask(__name__)@app.route('/',methods=["GET","POST"])defhello_world():ifrequest.method=="POST":countries=request.form["Enter Countries"]return''' <p>The countries you asked us to graph are {result}</p> <p><a href="/">Click here to calculate again</a> </body> </html> '''.format(result=countries)else:return <p>Enter your numbers:</p> <form method="post" action="."> <p><input name="Enter Countries" /></p> <p><input type="submit" value="Graph Countries" /></p> </form> </body> </html>
The error I am receiving is this:
2020-06-27 19:54:00,854: Exception on / [GET]
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
return self.finalize_request(rv)
File "/usr/lib/python3.8/site-packages/flask/app.py", line 1967, in finalize_request
response = self.make_response(rv)
File "/usr/lib/python3.8/site-packages/flask/app.py", line 2096, in make_response
raise TypeError(
TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.
2020-06-27 19:54:23,055: Exception on / [GET]
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
Please forgive me for being clueless, I am new to python anywhere. That being said, please help me find what is causing this error.
Sorry, we have had to rate-limit your feedback sending. Please try again in a few moments...
Thanks for the feedback! Our tireless devs will get back to you soon.