Any one is familiar with flask?


I am learning flask framework .For rendring simple html page i have write code in two saperate file.One is which is main file and consist of main code .Other one is hello.html.When i try to run flask app on command line it is showing me Serving Flask app "hello"
* Running on (Press CTRL+C to quit)
But when i tries to open it in browser it is displaying "HelloWorld".Then i tries to open with http://localhost:5000/result .It shows me -->
"The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again."I am really very sick of it despite of trying so many times i cannot run it .Although simple hello world app is working .
Here the code lies

from flask import Flask, render_template
app = Flask(__name__)

def result():
   dict = {'phy':50,'che':60,'maths':70}
   return render_template('result.html', result = dict)

if __name__ == '__main__': = True)

hello.html code:

<!doctype html>
      <table border = 1>
         {% for key, value in result.iteritems() %}
               <th> {{ key }} </th>
               <td> {{ value }} </td>
         {% endfor %}

Please try to help me . and assume indenataion as it is there in my code .


Mark the terminal output and python code as preformatted, not just the template :confused:


Sorry .I did not get you .Can you please deescribe it .


If you look at your post - it isn't possible to copy what you posted and run it because the formatting has made the code invalid.

If you fix the formatting, people can copy the code and run it themselves so that they can make their own observations and try things.



This is the same code i am using .


Can't copy text from screenshots though >.>


Sorry .I hope this will not irritate you .
Just see the code at the bottom of the page .


You said you named the template hello.html, but you're rendering result.html

(in other words, you're running code that is different from the one you shared in the link)

It's really important that you share exactly the same thing as you're running yourself, otherwise you're relying on others compensating by either knowing far more than they would otherwise need to or by putting in a bunch of extra work - similarly, it's just as important when looking for bugs yourself that you're looking at the right things


ok i understand that .But i am trying to put my original code but indentation is not coming there .
I have change that hello.html to result.html but there is no change .


Also, your code doesn't result in 404 on localhost:5000/result - the page is there but the template isn't found because of using different name for the file


I have change file name but nothing happens


If you look at your post, the template is entirely intact. So you could look at how that was done, and do the same with the rest of the code.

Also, it's about the realisation that it needs to be exactly right. So if one way doesn't work one would have to find another way around it. And there are plenty of ways around it, but since it's fairly simple to fix it in the post, that's the best option.


I no longer know what you're running.


I am rendring file result.html and i have created file hello.html therefore i have change hello.html to result.html .


Odds are I'm going to make those changes differently from you.
Show me how to reproduce how you have currently. It needs to be foolproof on both your end and mine, we need to do the same thing.


Ok .What can i do now .


Ok .What can i do now .How i shall proceed .


If there's a problem, you can describe it and show how to reproduce it. But you already know that :confused:
And others will need to see exactly what you're using, so it'll need to be exactly the same.


After making that change i am basically exporting flask app and running it on my command shell .
I hope this is you want or i misunderstood you .


See the problem? I don't get the same outcome. Because we're running different things. You need to share your files.