I am trying to get started with Flask, and I get 404 Not Found error for the hello world program.
The program I use:
from flask import Flask
app = Flask(__name__)
@app.route('/')
@app.route('/index.html')
def hello_world():
return 'Hello, World'
if __name__== '__main__':
app.run(host='localhost')
then I run
$export FLASK_APP = minimal.py
$flask run
Which returns:
* Serving Flask app "minimal"
* Forcing debug mode on
* Restarting with stat
* Debugger is active!
* Debugger PIN 127-804-808
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
When I visit http://localhost:5000 or http://127.0.0.1:5000, I get:
Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
And my host file looks like this:
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
Any idea whats wrong? Thank you
FLASK_APP
is wrong – hayden