Since Django 1.8 the subdomain-dependent template loading no longer worked, since the template directories were being cached once per worker, since EngineHandler.templates has the cached_property decorator.
It seems that a custom template loader would be a better way of arranging this subdomain-dependent template loading anyway, and that's the replacement method introduced in this pull request. Unfortunately, template loaders aren't passed the request object, so instead we're storing the subdomain in thread-local storage via some new middleware.
Coverage remained the same at 98.144% when pulling a916612d9b395768fea60fe101c2139dde150fc7 on fix-subdomain-dependent-templates into 085f1bbbd1cd9e998cc3a472a5cd2455356c4c33 on alpaca-rebased-django-1.8.
Coverage remained the same at 98.144% when pulling 47ac2d4421d53f4ab53d0e49d8912256feecaff3 on fix-subdomain-dependent-templates into 085f1bbbd1cd9e998cc3a472a5cd2455356c4c33 on alpaca-rebased-django-1.8.
Since Django 1.8 the subdomain-dependent template loading no longer worked, since the template directories were being cached once per worker, since EngineHandler.templates has the cached_property decorator.
It seems that a custom template loader would be a better way of arranging this subdomain-dependent template loading anyway, and that's the replacement method introduced in this pull request. Unfortunately, template loaders aren't passed the request object, so instead we're storing the subdomain in thread-local storage via some new middleware.
Fixes https://github.com/mysociety/alpaca/issues/64
Thanks to Matthew Somerville for his help in figuring out what was going wrong and possible solutions.