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
🧑💻 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)
🚀 Step 3: Run the App
python app.py
Go to http://127.0.0.1:5000/
in your browser — you should see:
Hello, Flask World!
🎉 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)