ecometrica / django-multisite

Multisite in django — use one Django app to serve multiple domains
BSD 3-Clause "New" or "Revised" License
138 stars 42 forks source link

Template loader alters path, can't find template again #77

Open jbazik opened 3 years ago

jbazik commented 3 years ago

Multisite's template loader alters the template path and passes that along to the django template loader. This works great unless some other app decides to cache that path and start over. One such app is nephila/djangocms-blog, which does this:

        selected = select_template(templates)
        return selected.template.name

(https://github.com/nephila/djangocms-blog/blob/develop/djangocms_blog/cms_plugins.py)

Select_template finds and loads the template, so the name passed back is altered by multisite. So, for instance, "home.html" is transformed into "default/home.html" which the multisite loader cannot find.

A simple workaround is to add the django loader to the template loaders. However, multisite's docs suggest that's not necessary.

I think the problem is with multisite, since it is a reasonable expectation that template.name can be reused. But I don't have a simple suggestion for how to fix this.