I used the Django docs to set up multiple databases in a master-slave configuration. My routers are set up correctly, and I can see that reads and write go to the correct respective database, but I am running into an error with some of my API calls:
cannot execute [UPDATE or DELETE] in a read-only transaction
In the API handlers where this happens, I am updating or deleting some other model as part of the same call, and Django seems to want to use a slave database for those transactions instead of master.
A workaround I found is to chain .using('default') before update() or delete(), which basically forces Django to use the master database for the update or delete. But this feels hacky and bandaid-ish, so I want to make sure there isn't a better way to do this.
Any help is much appreciated.