-
Notifications
You must be signed in to change notification settings - Fork 0
Route Not Found (404) Error for Root URL / #1
Copy link
Copy link
Open
Description
Description:
When running the provided Flask application, accessing the root URL http://127.0.0.1:5000/ returns a 404 Not Found error. However, the /home route works as expected.
Steps to Reproduce:
- Run the Flask application using the provided code snippet.
- Open a web browser and navigate to
http://127.0.0.1:5000/. - Observe the
404 Not Founderror. - Navigate to
http://127.0.0.1:5000/home, which works as intended.
Expected Behavior:
The root URL / should display content or redirect to /home.
Actual Behavior:
The root URL / returns a 404 Not Found error.
Code Snippet:
from flask import Flask
app = Flask(__name__)
@app.route('/home')
def home():
return "Welcome to your first Flask application!"
if __name__ == '__main__':
app.run(debug=True)Development Environment:
- OS: Ubuntu 24.04.
- Python Version: 3.12.3
- Flask Version: 3.0.3
Suggested Fix:
Add a route for / to handle root URL requests. For example:
@app.route('/')
def index():
return "Welcome to the root URL!"Let me know if you would like any additional details or clarifications.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels