Getting errors in web app

Hi I recently followed this Tutorial : Web app in pythonanywhere

This is the url of my site : Gta the legend web app

My profile is : gtathelegend

Can anyone please help me debug and guide me to get it working. Thanks. Vedaang.

Good place to start debugging a web app is to check its logs, especially the error log -- you'll find logs linked on the Web page on your account.

The error is

f"The view function for {request.endpoint!r} did not"

I cannot understand what is wrong that needs to be fixed.

Your view function (the one that is raising the error) needs to return something that can be used to create the response. If it returns None, then you will get that error.

This is the full code :

::: python

    # A very simple Flask Hello World app for you to get started with...  
from flask  import Flask, request  
from process import cal  
app = Flask(__name__) 
@app.route('/', methods = ["GET","POST"]) 
 def hello_world():

     errors = '' if request.method == "POST": 
     except: errors += "<p>{!r} is not a number.</p>\n".format(request.form["number1"])

           errors += "<p>{!r} is not a number.</p>\n".format(request.form["number2"]) 
       if n1 is not None and n2 is not None: 
                result=cal(n1,n2) return ''' 
                       <p> The result is {result} </p> 
                       <p> <a href="/">Click here to calculate again.</a></p> 
                </html> '''.format(result=result) 
                return ''' 
                        <p>Enter your numbers :</p> 
                        <form method="post" action="."> 
                        <p><input name ="number1" /></p> 
                        <p><input name ="number2" /></p> 
                        <p><input type ="submit" value="Do Calculation."/></p> 
              </html> '''.format(errors=errors)

Can you please tell me what is to corrected because I have copied it from your Blog Tutorial and this is giving error. I have made changes to only some variables. But do inform me what I did wrong. Thanks.

I can't read that code. Please format it so that it makes sense. You can use the method described below the edit field for the post.

@glenn I have corrected my post. Please let me know what to do do with it.

In your code, if either n1 is None or n2 is None, your function will not return anything and you will get that error.