Great! Just what I hoped to find. Thank you. Rodney
On Aug 16, 12:54 pm, fredb <fredbar...@gmail.com> wrote: > Rodney, > > Take a look at the render() [1] shortcut provided in Django 1.3. Also > the current trunk provides a static template tag [2]. > > Fred > > [1]https://docs.djangoproject.com/en/1.3/topics/http/shortcuts/#render > [2]https://docs.djangoproject.com/en/dev//ref/contrib/staticfiles/#static > > On Aug 15, 10:34 pm, Rodney Topor <r.to...@gmail.com> wrote: > > > > > As I understand it, when using the development server, if you want to > > access static files from templates, you write something like > > {{ STATIC_URL }}css/mystyle.css. For STATIC_URL to be bound to the > > value assigned in settings.py, it is apparently necessary to include > > "context_instance = RequestContext(request)" when you render the > > template. And you have to do this even if you don't need the > > RequestContext for CSRF protection or any other reason. In effect, > > that means you have to include the RequestContext *every* time you > > render a template (assuming every template contains a link to some > > static file such as a CSS style sheet, a JavaScript file, an > > about.html file, or whatever. But requiring "context_instance = > > RequestContext(request)" *every* time you render a template seems to > > violate the DRY principle. Is there some standard way to avoid this > > repetition? (I suppose I could write my own shortcut function > > render_to_response_with_request_context that provides a thin wrapper > > around render_to_response, but I'm hoping some standard solution > > already exists.) Sorry to be so long winded. > > > Rodney -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.