PUBLIC_SCHEMA_URLCONF
See original GitHub issueI was thinking about this for quite some time, but now in connection with #43 I could finally draft this idea: Get rid of PUBLIC_SCHEMA_URLCONF setting, and in the documentation, suggest a solution with a different wsgi_app for the public website which point to a different settings.py (settings_public).
# wsgi_main_website.py
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings_public")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
This would need to set up a new wsgi instance, but I don’t think that’s a problem and this would have the following benefits:
- We can remove
ContentType.objects.clear_cache()
from the middleware, because this case, every schema would have the same app in contenttypes in the same place. This causes +1 DB Query in every request, but if the cache is never cleared, Django (contenntypes) can nicely build up a cache for the objects I think. I can’t come up with a solution where PUBLIC_SCHEMA_URLCONF is in use and it’s not needed to modify Django core to get rid of this behavior. - as @bcarneiro put the question in #43 :
“What does your code do when I haveauth
andadmin
both on public and on tenant?” Does the user want shared apps referenced in public? Does he wantpublic
schema for the public website only and tenant apps without referencing public? It would be more clear what it means putting an app into both of the SHARED_APPS and TENANT_APPS; the user made a mistake 😃 or what would be even better I described in #43, to have a SHARED_MODELS setting. - Sometimes for the public website you want to have a CMS ex. http://www.django-cms.org, which want to take some control of the url routing because of dynamic pages, etc, and it would be very hard to integrate with this app.
I will do it myself for sure, because I think overall this is the right way to do it but would be nice to get some comments on this one, and I think others could benefit from this also.
Issue Analytics
- State:
- Created 10 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Using PUBLIC_SCHEMA_URLCONF in django-tenant- ...
I maintain Django-Tenants which is a fork of django-tenant-schemas. The public url file gets called when the domain doesn't match a tenant.
Read more >use `PUBLIC_SCHEMA_URLCONF` with no object for the ...
I'd like to achieve the following setup: When a user goes to www.<domain> they use the PUBLIC_SCHEMA_URLCONF and request.tenant is None
Read more >django.conf.settings.PUBLIC_SCHEMA_URLCONF Example
Here are the examples of the python api django.conf.settings.PUBLIC_SCHEMA_URLCONF taken from open source projects. By voting up you can indicate which examples ...
Read more >Using PUBLIC_SCHEMA_URLCONF in django-tenant- ...
I maintain Django-Tenants which is a fork of django-tenant-schemas. The public url file gets called when the domain doesn't match a tenant.
Read more >Schemas - Django REST framework
SchemaGenerator is a top-level class that is responsible for walking your configured URL patterns, finding APIView subclasses, enquiring for their schema ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi guys, I know it’s been a lot time since this discussion but I din’t found much in the docs. If I setup a separate WSGI settings, how do I declare database settings? Should I use the default postgresql backend for django? How do I manage the migrations? And in this separate settings the
django-tenant-shemas
app would exist at all ?I add a section to the documentation about this setup then.