Flask and choosing a framework · senior
Django, FastAPI or Flask, and mixing them
Choose by the job and the team: Django for admin-heavy and form-heavy apps, FastAPI for async I/O and typed APIs, Flask for small services. Two frameworks on one database need clear table ownership.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- Operations portal with forms and an admin: Django. Admin, auth, permissions, forms, ORM and migrations are built in. Django 5.2 is the LTS (supported until April 2028) and 6.1 is the latest release.
- Mobile API that fans out to partner services: FastAPI (async I/O, Pydantic validation, OpenAPI), or Django with async views or Django Ninja if the team and data already live in Django.
- Model serving: FastAPI is the common choice, with the model loaded in lifespan. Heavy GPU serving often uses a dedicated inference server with FastAPI in front.
- For most APIs the database and network dominate, so queries, caching and pool sizes matter more than framework overhead. Measure before choosing on speed.
- Flask: small services, existing code, teams that choose every piece. It is WSGI; async views still hold a worker per request.
- Team skills, hiring and libraries matter as much as features. Name the risks: FastAPI is 0.x with breaking minor releases; Django's async ORM is synchronous underneath.
- FastAPI next to a Django monolith: ask why first. One owner per table: Django keeps its tables and migrations; the new service owns its own schema through Alembic and reads Django data through an API or a read-only view, never by writing to Django tables.
- Auth between them: tokens (JWT or OIDC) from one auth service, not shared session cookies. Agree OpenAPI contracts, versioning, one log format, tracing and a deploy pipeline. Write a short design note and a date to review.
The red pen
Common traps: mistake → fix
Mistake: FastAPI is always faster, so choose it
Fix: the database dominates most APIs.
Mistake: Two ORMs can write the same tables
Fix: that is the biggest risk; give each table one owner.
Mistake: Share Django session cookies with the new service
Fix: fragile; use tokens.
Mistake: One framework for everything
Fix: choose per job, but keep the number of stacks small.
Easy to hard
Questions interviewers ask, easy to hard
- Django, FastAPI or Flask for an operations portal, a mobile API and a model-serving endpoint?
- What are the risks of FastAPI and of Django async?
- A new team wants FastAPI with SQLAlchemy on our Django database. What do you ask?
- How do the two services authenticate each other?
- What do you write down?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.