1. Which framework includes an admin site and ORM by default?
- Neither
- FastAPI
- Django
- Both equally
Show answer
Answer: Django
Batteries included.
Lesson: Django and FastAPI at a Glance
26 questions from the Django / FastAPI course, each with the correct answer and an explanation. Try to answer before you open the answer.
Answer: Django
Batteries included.
Lesson: Django and FastAPI at a Glance
Answer: Add it to INSTALLED_APPS
Apps are registered in settings.
Lesson: A Django Project and App
Answer: 422 Unprocessable Entity
Validation errors are 422 by default.
Lesson: A First FastAPI App
Answer: Removes them from the response
Output filtering prevents leaks.
Answer: By raising HTTPException with status 401
Dependencies can short-circuit requests.
Answer: It blocks the event loop and stalls other requests
Use await asyncio.sleep or async libraries.
Lesson: Async Endpoints
Answer: /docs
Swagger UI at /docs, spec at /openapi.json.
Lesson: Automatic OpenAPI Documentation
Answer: 409 Conflict
The request conflicts with current state.
Lesson: Error Handling
Answer: Set app.dependency_overrides[get_db] to a fake
Dependencies make testing easy.
Answer: Alembic
Migrations are separate from FastAPI.
Lesson: Databases With FastAPI
Answer: DecimalField
Exact decimal arithmetic.
Lesson: Defining Models
Answer: Writes migration files describing model changes
migrate applies; makemigrations writes.
Lesson: Creating Migrations
Answer: Prints the SQL for a migration without running it
Inspect before applying.
Answer: It records them in the django_migrations table
Applied migrations are tracked.
Lesson: Applying Migrations
Answer: When it is evaluated, for example iterated, listed, counted or fetched with get
QuerySets are lazy.
Answer: select_related
Join single-valued relations.
Lesson: Avoiding N+1 Queries
Answer: Doubles each row's price in a single SQL statement
Computation happens in the database.
Answer: Raises Http404, producing a 404 response
Clean not-found handling.
Lesson: Views and URLs
Answer: In a clean_<fieldname> method
Field-level clean methods.
Lesson: Forms and Validation
Answer: They are rolled back too
All or nothing.
Answer: Rolls back the database changes
Isolated tests.
Lesson: Testing Django Apps
Answer: Each hash uses a random salt
Salts defeat precomputed attacks.
Lesson: Password Hashing
Answer: DEBUG
Debug pages leak sensitive information.
Lesson: Deployment Security Checks
Answer: An ASGI server such as uvicorn
FastAPI is ASGI.
Lesson: ASGI and WSGI Servers
Answer: Inefficient database access
Measure the database first.
Lesson: Performance and Scaling
Answer: No blocking calls inside async def endpoints
Correct, efficient, secure.
Lesson: A Python Web Backend Checklist