On Tuesday, 9 August 2011 08:24:20 UTC+1, Rodney Topor wrote:
>
> I tried using a style sheet served as a static file with the tutorial 
> project.  In settings.py, I defined STATIC_URL = /static/ and 
> STATICFILES_DIRS = ('/path/to/project/static/',).  Then I defined a 
> base_html template with a line in the HEAD of the form 
>
>   <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }} 
> style.css" /> 
>
> and put style.css in directory /static/.  Finally, I defined 
> index.html, detail.html, etc., as given in the tutorial to each extend 
> base.html. 
>
> Everything works perfectly, except that only one template 
> (detail.html) correctly processes the {{ STATIC_URL }} value to find / 
> static/style.css.  In every other template, {{ STATIC_URL }} evaluates 
> to the empty string, giving just style.css, which does not exist of 
> course. 
>
> Every template extends the single base template in the same way.  So 
> why does {{ STATIC_URL }} work for some templates and not others? 
>
> Rodney


Because you need to use a RequestContext to render the template.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/H_SiI4YEu1YJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to