Knowledgebase

Python Backends: Everything That Matters, Briefly Print

  • backenddevelopment, backend, migration, performance, guide, howto, solution, zillionkinghost
  • 0

The summary.

ALWAYS USE AN ISOLATED ENVIRONMENT WITH PINNED DEPENDENCIES

Otherwise projects conflict.

On hosting that manages the application for you, restart after any change to code, dependencies or environment — "changes not taking effect" is the commonest report by far.

REVIEW GENERATED MIGRATIONS BEFORE APPLYING THEM

They occasionally do something destructive you did not intend.

THE COMMONEST PERFORMANCE FAULT IS A QUERY PER ITEM IN A LOOP

Select or prefetch related data with the original query, and monitor query count per request during development.

Querysets are lazy — the place a query executes may not be where it was written.

DJANGO'S ADMINISTRATIVE INTERFACE IS A GENUINE ADVANTAGE

But never expose it at its default address, and never treat it as a user-facing interface.

FLASK GIVES YOU ROUTING AND LITTLE ELSE

Impose structure before the application grows, and never let the development server handle production traffic.

IN FASTAPI, NEVER MIX BLOCKING CALLS INTO ASYNCHRONOUS HANDLERS

It stalls every request. And define separate input and output models, so internal fields are not exposed.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot