-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Domain aliases for flexibility in schema selection. #10
Comments
Hello bogeymin, thank you very much for your feedback! From your user case, I wonder if simply having multiple lines with the same schema_name would work? The field schema_name does not need to be unique, so I think you should also be ok without having to change any code. If you want I can take a look at your code. :) Cheers, |
The schema_name (and domain_url) field is currently a varchar, but isn't it the domain_url that gets checked to determine which schema to use? That's the situation I'm in. My admin site is located at one domain, but I need a public domain to host the non-admin views using the same schema as the admin site -- that is, I need two domain_urls to point to the same schema. It's sort of like Apacghe's ServerAlias directive which listens to more domain names but still points at the same document root. I will fork the code and push my changes if you want to have a look. Though I have implemented multi-tenancy in the past, and I have looked at all of the available solutions, I think Tenant Schemas is the best work I've seen thus far, and I would be happy to contribute to the project. On Aug 12, 2012, at 5:27 PM, Bernardo Pires wrote:
|
Yes, it's the domain_url that gets checked to determine the schema to use. But I'm not sure if I understood your problem correctly. You want subdomain1.domain.com/my/view to be the exact same page (and schema) as on subdomain2.domain.com/my/view, correct? If that's the case, you should be able to have your lines on the database like this: <domain_url> And it should work exactly as what you wanted. But it seems you have other view routing needs, as you use the same schema but have different views. And yes, I'd love to take a look at your code. It's very satisfying to see people are using and liking this app! Thanks for the compliments and I'd love your help! You can take a look at our list of issues when you have the time. :) |
In this particular project, the admin site is located on one subdomain and the public site is located on another subdomain, but both use to the same database schema. On Aug 14, 2012, at 5:12 AM, Bernardo Pires wrote:
|
https://github.com/bogeymin/django-tenant-schemas/tree/develop/tenant_schemas Changes were made in middleware.py and models.py to add a domain_aliases (text field) to effectively allow multiple domains to answer for a single tenant. As a refresher, the feature in question is basically to allow subdomain1.example.com/admin and and subdomain2.example.com to both use the same postgres schema. |
@bernardopires Is the field domain_aliases not existing in the master branch version? |
My particular use-case may be on the edge, but I have a situation where I need the dynamic schema selection to occur on two or more domain names. For example, subdomain1.example.com and subdomain2.example.net could both use the same postgres schema. The solution I implemented was to:
One could implement the domain_aliases as an external table, but it seems like this simpler approach would work, and saves an additional relationship. I suppose my solution could be reduced to a single database call by using filter() once instead of get() twice, but the result would be less precise.
At any rate, I pushed this change into production these evening and it works great.
Would anyone like to see the code? Or receive a pull request?
The text was updated successfully, but these errors were encountered: