This simple Flask app shows a welcome message on the home page. Running it starts a small web server you can visit in your browser at http://127.0.0.1:5000/.
Flask
from flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
return'Welcome to Flask Micro-framework!'if __name__ == '__main__':
app.run(debug=True)
OutputSuccess
Important Notes
Flask is called a micro-framework because it keeps things small and simple.
You can add extra tools later as your app grows.
Flask is great for beginners and small projects.
Summary
Flask gives you a simple start to build web apps.
It lets you add only what you need, keeping things light.
Perfect for learning and small to medium projects.
Practice
(1/5)
1. Why is Flask called a micro-framework?
easy
A. Because it includes a built-in database and admin panel
B. Because it is designed only for small websites and cannot scale
C. Because it provides only the core features and lets you add extensions as needed
D. Because it requires a lot of setup and configuration before use
Solution
Step 1: Understand the meaning of micro-framework
A micro-framework provides only essential features, avoiding extra built-in tools to keep it simple and lightweight.
Step 2: Relate Flask's design to micro-framework traits
Flask offers core web handling and lets developers add only what they need via extensions, matching the micro-framework idea.
Final Answer:
Because it provides only the core features and lets you add extensions as needed -> Option C
Quick Check:
Micro-framework = core features only [OK]
Hint: Micro means minimal built-in features, add what you want [OK]
Common Mistakes:
Thinking Flask cannot scale for bigger projects
Assuming Flask has many built-in tools like admin panels
Believing Flask requires heavy setup before use
2. Which of the following is the correct way to create a basic Flask app?
easy
A. from flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
return 'Hello World!'