What is a 'Database Router' in Django, and in what scenario would you need to implement one?
Last updated
A database router is a class that picks which
DATABASESalias to use viadb_for_read,db_for_write,allow_relationandallow_migrate.Use one for primary/replica read-write splitting, separating apps or shards into different databases, or routing models to a legacy DB.
Enable it in
DATABASE_ROUTERS. Beware replication lag and send read-after-write queries to the primary.
- https://www.geeksforgeeks.org/python/django-interview-questions/
- https://foysalff.medium.com/12-advanced-django-interview-questions-for-experienced-developers-dbe654e21a45
- https://www.careers360.com/courses-certifications/articles/django-interview-questions-and-answers
- https://www.interviewbit.com/django-interview-questions/
- https://www.youtube.com/watch?v=OuBUUkQfBYM
- https://www.placementpreparation.io/blog/django-interview-questions-for-freshers/