Using Multiple databases

62 views
Skip to first unread message

Vasanth Mohan

unread,
Apr 6, 2022, 12:32:35 PM4/6/22
to Django users
Hello,

I'm building a PoC for a multi-tenant app where I'm trying to use the same schema across multiple databases with Django instance. I've got a couple of questions and I'd be happy to have some input

1. Is there a way to define the using() function to use with Models via a lib/middleware?
2. Is there a way to create admin users so that they have access to specific databases? 

Regards,
Vasanth M

Ryan Nowakowski

unread,
Apr 15, 2022, 2:08:23 PM4/15/22
to Django users
On Wed, Apr 06, 2022 at 08:59:09AM -0700, Vasanth Mohan wrote:
> I'm building a PoC for a multi-tenant app where I'm trying to use the same
> schema across multiple databases with Django instance. I've got a couple of
> questions and I'd be happy to have some input
>
> 1. Is there a way to define the *using()* function to use with Models via a
> lib/middleware?
> 2. Is there a way to create admin users so that they have access to
> specific databases?

You probably want to create a custom database router[1].

[1] https://docs.djangoproject.com/en/4.0/topics/db/multi-db/#automatic-database-routing
Reply all
Reply to author
Forward
0 new messages