Changes between Initial Version and Version 1 of Ticket #24742, comment 3
- Timestamp:
- May 7, 2015, 11:30:22 AM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #24742, comment 3
initial v1 1 1 Adding a router that redirects migrations to a different db is exactly what I did for a recent project, - it works just fine. 2 3 [edit] After looking it up, I did the reverse: I defined default writable db and set up routers for all read-only dbs: 4 5 class AppRouter(object): 6 app_name = None 7 def db_for_read(self, model, **hints): 8 if model._meta.app_label == self.app_name: 9 return self.app_name 10 return None 11 12 class ReadonlyRouter(AppRouter): 13 app_name = 'my_ro_app'