From fcb4989bed1a23ab43ed2fe6fef0274cd05e791d Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Tue, 1 Sep 2009 00:11:44 +0200 Subject: [PATCH] auto-detect the script prefix path under which mumble-django is running --- pyweb/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pyweb/__init__.py b/pyweb/__init__.py index cab0bd4..06095bc 100644 --- a/pyweb/__init__.py +++ b/pyweb/__init__.py @@ -12,3 +12,17 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. """ + +from django.core import signals + +def update_paths( **kwargs ): + from django.core.urlresolvers import get_script_prefix, reverse + from os.path import join + from django.conf import settings + pf = get_script_prefix(); + settings.MEDIA_URL = "%sstatic" % pf; + settings.ADMIN_MEDIA_PREFIX = "%smedia" % pf; + settings.LOGIN_URL = reverse( "django.contrib.auth.views.login" ); + signals.request_started.disconnect( update_paths ); + +signals.request_started.connect( update_paths );