Building a Simple Flask Webpage with @app.route
📖 Scenario: You are creating a small web application using Flask. You want to show a welcome message on the homepage.
🎯 Goal: Build a Flask app that shows 'Welcome to Flask!' when you visit the homepage URL.
📋 What You'll Learn
Create a Flask app instance named
appUse the
@app.route decorator to define the homepage route '/'Define a function called
home that returns the string 'Welcome to Flask!'Run the Flask app with debug mode enabled
💡 Why This Matters
🌍 Real World
Web developers use Flask and the @app.route decorator to create web pages and APIs that respond to different URLs.
💼 Career
Understanding routing in Flask is essential for backend web development jobs that build Python web applications.
Progress0 / 4 steps