shiwangi nayak
shiwangi nayak

Reputation: 31

'The requested URL was not found on the server'

from flask import Flask
app = Flask(__name__)

@app.route('/hello')
def hello_world():
    return "Hello world"

if __name__ == '__main__':
    app.run(host='0.0.0.0',port=8000, debug=True)

While clicking the link http://0.0.0.0:8000/, it is showing:

> The requested URL was not found on the server If you entered the URL
> manually please check your spelling and try again.

Upvotes: 0

Views: 364

Answers (1)

DanielB
DanielB

Reputation: 2958

The only URL you have defined is /hello, so when you request /, there is nothing to be served, so you get the Not Found Error. You'll need to either define something for / or use http://0.0.0.0:8000/hello instead. E.g.,

@app.route('/')
def index_view():
    return "hello from index"

Upvotes: 1

Related Questions