Thank you both! I was using the reference in the base template, but was missing that first /. I appreciate you time.
On Feb 1, 1:18 pm, Brian Rosner <[EMAIL PROTECTED]> wrote: > > I am having trouble getting my stylesheet to appear in each html > > file. I have a base template that contains the path to the css file. > > Each page that extends the base template simply adds the path of the > > css file on to its current uri to get the wrong location. Is there a > > way to specify the css file in one location and have the other > > templates find it regardless of the URI? > > It sounds like you are not using an absolute path. The way I handle a > CSS file across several pages is to have my base.html look similar to: > > <html> > <head> > <title>something</title> > <link href="/media/css/styles.css" rel="stylesheet" type="text/css" /> > </head> > > The first slash in /media/css/styles.css is critical since it tells the > webserver to look at the root of the domain. If left off it will become > relative to the page you are viewing. For > example:http://localhost/my_cool_urlwould then yield a lookup > forhttp://localhost/my_cool_url/media/css/styles.cssas opposed to > justhttp://localhost/media/css/styles.css. > > It is also common pratice to use MEDIA_URL to cut down on having to > always know the media path. Using it will change simple change the url > to {{ MEDIA_URL }}css/styles.css and MEDIA_URL = "/media/" in your > settings.py. Make sure you are using the RequestContext to ensure {{ > MEDIA_URL }} is displayed correctly in your templates. (This will only > work if you are using HEAD of Django trunk, otherwise you must write > your own context_processor). > > -- > Brian Rosnerhttp://oebfare.com --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---