DEV Community

Vivian Gichure
Vivian Gichure

Posted on

Getting Started with Flask — Your First Web App in 10 Minutes

If you’re new to Python web development, Flask is one of the easiest frameworks to start with. It’s lightweight, flexible, and perfect for building simple APIs or full web apps. Let’s build a tiny “Hello, World!” app together. 👩‍💻

🛠️ Step 1: Install Flask

Make sure you have Python installed, then run:

pip install flask
Enter fullscreen mode Exit fullscreen mode

🧑‍💻 Step 2: Create app.py

from flask import Flask

app = Flask(__name__)

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

if __name__ == "__main__":
    app.run(debug=True)
Enter fullscreen mode Exit fullscreen mode

🚀 Step 3: Run the App

python app.py
Enter fullscreen mode Exit fullscreen mode

Go to http://127.0.0.1:5000/ in your browser — you should see:

Hello, Flask World!
Enter fullscreen mode Exit fullscreen mode

🎉 Congratulations! You’ve just built your first Flask web application. From here, you can add more routes, return HTML templates, or build REST APIs.

💡 Pro tip: Add debug=True while developing to get automatic reloads and detailed error messages.

Top comments (0)