id,page,ref,title,content,breadcrumbs,references plugin_hooks:plugin-hook-jinja2-environment-from-request,plugin_hooks,plugin-hook-jinja2-environment-from-request,"jinja2_environment_from_request(datasette, request, env)","datasette - Datasette class A Datasette instance. request - Request object or None The current HTTP request, if one is available. env - Environment The Jinja2 environment that will be used to render the current page. This hook can be used to return a customized Jinja environment based on the incoming request. If you want to run a single Datasette instance that serves different content for different domains, you can do so like this: from datasette import hookimpl from jinja2 import ChoiceLoader, FileSystemLoader @hookimpl def jinja2_environment_from_request(request, env): if request and request.host == ""www.niche-museums.com"": return env.overlay( loader=ChoiceLoader( [ FileSystemLoader( ""/mnt/niche-museums/templates"" ), env.loader, ] ), enable_async=True, ) return env This uses the Jinja overlay() method to create a new environment identical to the default environment except for having a different template loader, which first looks in the /mnt/niche-museums/templates directory before falling back on the default loader.","[""Plugin hooks""]","[{""href"": ""https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.Environment"", ""label"": ""Jinja environment""}, {""href"": ""https://jinja.palletsprojects.com/en/3.0.x/api/#jinja2.Environment.overlay"", ""label"": ""overlay() method""}]"