All questions
Showing of 56How do you create a basic Flask application?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
A basic Flask application requires creating a Flask instance and defining routes:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
if __name__ == '__main__':
app.run(debug=True)
The Flask(__name__) creates the application instance, @app.route() decorator defines URL endpoints, and app.run() starts the development server.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the significance of `__name__` in `Flask(__name__)`?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
The __name__ parameter helps Flask determine the root path of the application, which is used for:
- Resource location: Finding templates, static files, and other resources
- Import name: Used for extensions and debugging
- Module identification: Helps Flask understand the application's module structure
When run directly, __name__ equals '__main__', but when imported as a module, it contains the actual module name.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How do you handle different HTTP methods in Flask routes?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Specify HTTP methods using the methods parameter in the route decorator:
@app.route('/api/users', methods=['GET', 'POST'])
def handle_users():
if request.method == 'POST':
return create_user()
return get_users()
@app.route('/api/users/<int:user_id>', methods=['PUT', 'DELETE'])
def handle_user(user_id):
if request.method == 'PUT':
return update_user(user_id)
elif request.method == 'DELETE':
return delete_user(user_id)
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are URL variables and how do you use them?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
URL variables capture dynamic parts of URLs and pass them as function arguments:
@app.route('/user/<username>')
def show_user(username):
return f'User: {username}'
@app.route('/post/<int:post_id>')
def show_post(post_id):
return f'Post ID: {post_id}'
@app.route('/path/<path:subpath>')
def show_subpath(subpath):
return f'Subpath: {subpath}'
Variable types include string (default), int, float, path, and uuid.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is URL building and how do you use `url_for()`?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
url_for() generates URLs for routes by endpoint name, providing URL reversal:
from flask import url_for
@app.route('/user/<username>')
def user_profile(username):
return f'Profile for {username}'
@app.route('/')
def index():
# Generate URL for user_profile endpoint
profile_url = url_for('user_profile', username='john')
return f'<a href="{profile_url}">John\'s Profile</a>'
Benefits include automatic URL updates when routes change and proper URL escaping.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How do you handle query parameters in Flask?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Access query parameters using request.args:
from flask import request
@app.route('/search')
def search():
query = request.args.get('q', '')
page = request.args.get('page', 1, type=int)
category = request.args.getlist('category') # Multiple values
return f'Query: {query}, Page: {page}, Categories: {category}'
Use get() for single values with defaults, getlist() for multiple values.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How do you access request data in Flask?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Flask provides the request object to access various types of request data:
from flask import request
@app.route('/form', methods=['POST'])
def handle_form():
# Form data
username = request.form['username']
email = request.form.get('email', '')
# JSON data
if request.is_json:
data = request.get_json()
# Files
if 'file' in request.files:
file = request.files['file']
# Headers
auth_header = request.headers.get('Authorization')
# Cookies
session_id = request.cookies.get('session_id')
return 'Data processed'
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What's the difference between `request.form`, `request.args`, and `request.get_json()`?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
These access different types of request data:
request.form: POST form data (application/x-www-form-urlencoded or multipart/form-data)request.args: URL query string parametersrequest.get_json(): JSON data from request body (application/json)
# URL: /api?page=1
# Body: {"name": "John"}
# Form data: username=admin
@app.route('/api', methods=['POST'])
def api():
page = request.args.get('page') # "1"
name = request.get_json()['name'] # "John"
username = request.form.get('username') # "admin"
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are Flask's built-in response helpers?
How do you render templates in Flask?
How do you pass data to templates?
How do you handle forms in Flask?
How do you manage sessions in Flask?
How do you handle errors in Flask?
What are Flask environment variables and how do you use them?
What is WSGI and how does Flask relate to it?
Explain the Flask application context and request context.
How do you create URL rules dynamically?
How do you handle file uploads in Flask?
How do you create custom response objects?
What are the key features of Jinja2 templating?
What are Jinja2 filters and how do you create custom ones?
How do you handle template inheritance?
What is Flask-WTF and how does it help with forms?
How do you implement CSRF protection in Flask?
How do you perform custom form validation?
How do you integrate databases with Flask?
What are database migrations and how do you handle them?
How do you perform database queries in Flask-SQLAlchemy?
How do you define relationships between models?
What are the different session storage options in Flask?
How do you implement user authentication in Flask?
How do you implement custom exceptions?
How do you implement logging in Flask?
What are common security vulnerabilities in Flask applications?
How do you secure Flask applications?
How do you handle password security?
What are Flask Blueprints and why use them?
How do you structure a large Flask application?
What is the Application Factory pattern?
How do you create RESTful APIs with Flask?
How do you handle JSON serialization for complex objects?
How do you implement API versioning in Flask?
How do you test Flask applications?
How do you test API endpoints?
How do you mock dependencies in Flask tests?
How do you configure Flask applications for different environments?
How do you deploy Flask applications?
How do you implement rate limiting in Flask applications?
How do you handle database transactions in Flask?
How do you handle API authentication and authorization?
How do you implement caching in Flask?
How do you implement background tasks in Flask?
How do you implement WebSocket support in Flask?
How do you handle database connection pooling?
How do you implement custom middleware in Flask?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
Flask cheatsheet
- Flask Basics01
- Routing & Views02
- Request Handling03
- Templates (Jinja2)04
- Forms & Validation05
- Database Integration06
- Authentication & Sessions07
- RESTful APIs08
- Error Handling09
- Testing10
- Configuration & Deployment11
- Performance & Security12
- + 5 more inside
- + 11 more inside
48 of 56 Flask answers are in Pro.
Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.
- Full answers + code
- AI explanations, simpler or deeper
- 1,000 AI credits / month
- Cancel anytime
Change topic
Pick a different technology or stack. Your current topic stays put until you choose a new one.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.