Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make django-multisite location independant #1

Open
daks opened this issue Nov 17, 2009 · 3 comments
Open

Make django-multisite location independant #1

daks opened this issue Nov 17, 2009 · 3 comments

Comments

@daks
Copy link

daks commented Nov 17, 2009

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:
@shestera
Copy link
Owner

Thank you.
Has laid your patch, but it vsetaki is not the problem with downloading templates.

http://github.com/shestera/django-multisite/commit/e06e4262e5f8b94b654ac79e5bd00b47c64e5155

@daks
Copy link
Author

daks commented Nov 21, 2009

Maybe call to os.path.join with TEMPLATE_DIRS needs to be enclosed in a try: except statement, because if TEMPLATE_DIRS does not exist an exception will be raised.

sorry but what is 'vsetaki'?

thanks for quick reaction

@shestera
Copy link
Owner

OK, I think that this can be done.
the word was "all the same":)

sfllaw referenced this issue in ecometrica/django-multisite Feb 1, 2012
I've fixed the admin file to filter using the actual default manager, rather than rely on the conventional "objects".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants