--
Ticket URL: <https://code.djangoproject.com/ticket/18225>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_docs: => 0
* needs_better_patch: => 0
* needs_tests: => 0
* easy: 0 => 1
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/18225#comment:1>
* status: new => assigned
* cc: moritz.sichert@… (added)
* owner: nobody => moritzs
--
Ticket URL: <https://code.djangoproject.com/ticket/18225#comment:2>
* has_patch: 0 => 1
Comment:
Added patch ([https://github.com/django/django/pull/37 Github Pull
Request])
--
Ticket URL: <https://code.djangoproject.com/ticket/18225#comment:3>
* status: assigned => closed
* resolution: => wontfix
Comment:
First of all, please don't accept your own tickets, we have a community of
ticket triagers that didn't have a chance to see this ticket since you
didn't leave it at the Unreviewed state.
Secondly, I'm sorry but this isn't Django's fault, if you're missing a
file, it's good to raise an exception. You quoted a part of the
documentation of how to write the render method of custom template tags,
not how template tags should work in general. It is an error to refer to a
file with the staticfiles' static template tag as it uses a storage
backend to calculate the URL of the static files. If you just want to
generate a URL that is concatenated with STATIC_URL, use the core static
template tag:
https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#std
:templatetag-static
--
Ticket URL: <https://code.djangoproject.com/ticket/18225#comment:4>
Comment (by anon0405@…):
It would be nice if there were a setting that toggled whether this fails
loudly or silently -- often it is better to serve an html file with broken
formatting (missing css), missing functionality (missing js), or missing
niceties (missing .ico) than to throw up a server error and prevent any
information from reaching the end user.
Especially where the behavior of {% static %} is explicitly to not raise
errors in development, the current behavior creates time bombs that are
out of step with the rest of django's template error philosophy -- fail
silently whenever possible.
Two options are:
* {% static 'file/path.stuff' True %} -- passing an optional parameter of
whether to fail silently, so this can be turned on/off as needed
* STATIC_TAG_FAILS_SILENTLY=True -- an option in settings.py
If there isn't a way to make it fail silently in production, then the
errors should somehow be raised in DEV so they are caught and fixed.
--
Ticket URL: <https://code.djangoproject.com/ticket/18225#comment:5>