On 6/14/06, plungerman <[EMAIL PROTECTED]> wrote: > that is precisely what i would like to do. how you access a > variable defined in settings.py from a template tho? i have > not been able to track this bit down.
Here's what I have. in settings.py: APP_BASE = "http://www.mysite.org/" in templatetags directory, somewhere on django's path, is a file sitevars.py ---- from django import template from django.conf import settings register = template.Library() @register.simple_tag def site_base(): return settings.APP_BASE some other utility stuff... ---- in any template, I can use: {% load sitevars %} ... <a href="{% site_base %}...."> ---- Custom tags are ridiculously easy with simple_tag and inclusion_tag. See http://www.djangoproject.com/documentation/templates_python/#shortcut-for-simple-tags One other thing I picked up in this group, is to use a local_settings.py for stuff like this that will be different for development, test, production servers. You just import it into your settings.py, then you can have different base URIs for each environment. -- Derek --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---