How to enable templates for each site in the Mezzanine multi-story office

We are expanding our business in Europe, and I use the Mezzanine multitasking feature to host both versions of the US and EU website on the same Django installation. We have a page /locationson each site that I would like to use with different templates based on SITE_ID.

I followed Mezzanine sparse documentation here and added tosettings.py

following:
HOST_THEMES = [
    ('domain.com', 'domain_app'), 
    ('domain.eu', 'domain_eu')
]

I added domain_euin INSTALLED_APPSafter the base topic and used python manage.py startapp domain_euto create the directory and manually created the file domain_eu/templates/pages/locations.html.

Then I copied the locations page and assigned it to the EU website.

The page is still displayed with the location template located in the base theme. domain_app/templates/pages/locations.html

, SITE_ID.

/ SITE_ID?

+4
1

Mezzanine code , eu . mezzanine/utils/sites.py

def host_theme_path(request):
    """
    Returns the directory of the theme associated with the given host.
    """
    for (host, theme) in settings.HOST_THEMES:
        if host.lower() == request.get_host().split(":")[0].lower():

request.get_host(), , localhost, HOST_THEMES.

, Mezzanine site_id , , -, .

, /etc/hosts :

127.0.0.1 domain.eu

, domain.eu/locations, ( dev)

+3

All Articles