views.py
1.65 KB
-
Add a view for collecting static files before serving them. · 00c580ac
In a Django development setup, it's common to have a /static/ URL set up to serve static media to the browser upon request. That's usually set to either serve out of a specific directory or out of any configured finders. However, the former doesn't guarantee any referenced files were collected first, and the latter only considers source files (for the purposes of timestamp calculation/caching) and not the collected/compiled files. This change introduces a new view, meant for use with Django's static serving view, that will collect the referenced file before serving it, guaranteeing that media like images and fonts are present. To ensure that this view will return content quickly (especially considering it will serve up any files referenced by the template tags), an optimization was made to Collector to allow the caller to collect only the given list of files. The view makes use of this to handle the collection process fast.
Christian Hammond committed