The solution is an elegant one, however, there is an issue I want to discuss further after applying it.
When the solution is applied, it works but with some trouble that might compromise testability. Since it will try to connect the production db and throws 'OperationalError' after trying to connect it for awhile and then it moves on to the next one, which is the local db for this case. Then, the test takes a lot longer with local db. Can this issue be circumvented so that test "experience" can be as much as like to the technique that I started with this thread (manually toggling on and off db endpoints)? If the issue persists, I guess our team will perform the test a lot more less, or go back to switching the endpoints manually, which is not a too much hassle. But what I am afraid of is that someone forgets to turn the endpoint back to the production before submitting the code and it goes live.

