Skip to content

Make django-multisite location independant #1

@daks

Description

@daks

Hi,

the actual code of the application enforce the 'installation' in the actual project directory, where it can find the 'templates' one.
It should be interesting to be able to install django-multisite systemwide or anywhere in the PYTHONPATH without this restriction.

Please look at the following patch which i think solves the problem (using TEMPLATE_DIRS[0]):

--- a/multisite/template_loader.py
+++ b/multisite/template_loader.py
@@ -5,7 +5,7 @@ from django.contrib.sites.models import Site
from django.conf import settings

def get_template_sources(template_name, template_dirs=None):
-    template_dir = os.path.join(os.path.normpath(os.path.dirname(__file__)), '..', 'templates', Site.objects.get_current().domain)
+    template_dir = os.path.join(settings.TEMPLATE_DIRS[0], Site.objects.get_current().domain)
    try:
      yield safe_join(template_dir, template_name)
    except UnicodeDecodeError:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions