Hello,

I use the sites framework for a Django project that serves many different 
domains. But each of those domains has some templates overridden.

If I used a different instance of Django (i.e. a different gunicorn 
service) for each domain, I'd have different settings for each site. But 
I'm using a single instance to serve all sites and, wherever I need to, I 
use things that extract the domain from the request, like 
`get_current_site()`. But this doesn't seem to work with templates. A 
custom template loader won't work without a fight because its methods don't 
accept the request object as an argument.

All solutions I've thought about are ugly hacks. The least ugly seems to be 
to create middleware that stores the request object in a contextvar 
<https://docs.python.org/3/library/contextvars.html>. But it strikes me 
that I can't find a simpler solution for this. Is what I want that 
uncommon, or am I missing something?

There's an old closed "wontfix" ticket 
<https://code.djangoproject.com/ticket/13500> about this but without 
adequate explanation.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/175b4601-2038-479b-9581-48d9c196df7cn%40googlegroups.com.

Reply via email to