Reputation: 59
I am trying to learn how to build applications with Python Flask, and am having trouble with their tutorial at this address: http://flask.pocoo.org/docs/tutorial/. I followed all the instructions (folder structure, files, etc.) but when I run the application on the command line with python, the application does not run when I plug in the web address into my browser. I am very new to Python so any help would be appreciated. What could be going on?
Upvotes: 0
Views: 158
Reputation: 1621
OK, I look through your code. It appears to be a simple error:
In flaskr.py, move these two lines to the end of the file.
if __name__ == '__main__':
app.run()
Then it works. The reason is when you run
python flaskr.py
it goes through the file and when it reaches those two lines it runs the server at which point route '/' is not registered. Therefore it gives a 404.
Upvotes: 1