pallets / flask

The Python micro framework for building web applications.

Home Page:https://flask.palletsprojects.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Starter example results in 404 error

gwilku opened this issue · comments

The basic example from the readme / flask docs throws a 404 error instead of returning the Hello World message

If you run the code from the example:

# save this as app.py
from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello, World!"

and then open 127.0.0.1:5000

Instead of getting the Hello World message, you get a 404.
When re-trying the app exits with code 0 instead of launching the server.

Environment:

  • Python version: 3.12
  • Flask version: 3.02

The next line down in the readme shows running flask run to run the development server.

I can't reproduce this issue with the information provided. The example works correctly when I run it.