On Thu, Jun 12, 2008 at 7:00 PM, Devin Venable <[EMAIL PROTECTED]> wrote:
> > I've just started using template inheritance (nice) and I have some > include files that I've placed in a common base. These are things you > would see in the head of an html file like css and js files, for > example: > > <script src="media/js/mootools/mootools.svn.js" > type="text/javascript"></script> > > The files are statically served by Apache. All is working well, except > some of my templates are in different folders in a directory > structure. > > f1 > template1.html > |_____f2 > |____template2.html > |____template3.html > > When the pages are rendered, the media directory is rooted at the > subfolder instead of the root folder. Therefore the css and js files > are not detected unless the templates reside at root. One solution > would be to serve all templates out of the top directory. But of > course I don't want to do that. Another solution would be to provide > a complete URI in the src tag: > > <script src="http://mytestsite/js/mootools/mootools.svn.js" > type="text/javascript"></script> > > But I don't want to do that either. > > Yet another solution is to provide a different relative path depending > on which directory my page is served from. > > <script src="media/js/mootools/mootools.svn.js" > type="text/javascript"></script> > <script src="../media/js/mootools/mootools.svn.js" > type="text/javascript"></script> > <script src="../../media/js/mootools/mootools.svn.js" > type="text/javascript"></script> > > Perhaps there is a template tag that allows something like this? > <script src="{{ webroot }}media/js/mootools/mootools.svn.js" > type="text/javascript"></script> > > I see the MEDIA_URL variable in settings.py, however this doesn't seem > to be relevant here, thought there is not much in the documentation > about this. > > Any ideas? Did I miss the obvious solution? > I think you want to use the MEDIA_URL setting, as described here: http://code.djangoproject.com/wiki/CookBookUsingExternalMedia Be sure to read to the end of that page since Django did add some built-in support for this and it's mentioned right at the end. Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

