|
Does anyone have any ideas / examples of how to design a project with different databases for different users? The idea is you would log in with username / password / group code and then be in a different database based on the group code (with no shared auth, each database has its own auth table). Database routers have no access to requests. There's some bullshit online about using thread local variables which seems dumb and fragile. Possibly this isn't something that Django can handle with a basic single server setup but maybe there's something I'm missing.
|
# ¿ Aug 27, 2021 07:53 |
|
|
# ¿ May 15, 2024 02:28 |
|
skull mask mcgee posted:Is this the thread local variable solution you’re referring to? Because it doesn’t look terribly unreasonable for the constraints you laid out. Basically I don't trust doing that kind of thing with threads when you're deployed on some cloud VM. I think you're right that there should be separate instances.
|
# ¿ Aug 27, 2021 19:09 |
|
`self.fieldsets` is a class attribute (not an instance attribute) and modifying it is not thread safe. I think what you want is to override get_fieldsets instead.
|
# ¿ Sep 21, 2021 06:47 |