django-tenant-schemas icon indicating copy to clipboard operation
django-tenant-schemas copied to clipboard

Avoiding hard-coding the domain in `domain_url`

Open veeral-patel opened this issue 7 years ago • 1 comments

Hi all! My tenants table looks like this -

| name     | schema_name | domain_url        |
|----------|-------------|-------------------|
| Tenant 1 | tenant1     | tenant1.localhost |
| Tenant 2 | tenant2     | tenant2.localhost |
|          |             |                   |

When developing locally, the URLs work fine. However, when I deploy to Google App Engine with a different domain, it probably won't work because my domain_url is hard-coded as tenantX.localhost.

I could write a script that changes the domain_url for each row in the table.

But I foresee changing domains again in the future, so I was wondering if there's some way to store the domain outside the database (eg in an environment variable) so it can be changed immediately for all tenants.

Thanks!

veeral-patel avatar Sep 02 '18 17:09 veeral-patel

Write your own custom middleware (https://django-tenant-schemas.readthedocs.io/en/latest/advanced_usage.html).

munavvar20 avatar Oct 10 '18 01:10 munavvar20