Hi Renato,
Sorry for being a little late to this party.
On Sunday 01 June 2014 17:36:43 Renato Oliveira wrote:
>
> Yeah, i'm aware of this, and sorry for not being explicit. The goal of this
> improvement is to point to many places. For exampe, if I have a project
> with, bootstrap, jquery and angular. I can do this:
>
> {% static 'path/to/my/angular.js'
http://googlecdn/angular.js %}
> {% static 'path/to/bootstrap.css'
http://bootstrapcdn/bootstrap.css %}
>
> And If I have to write some css or js file,
>
> {% static 'path/to/users.js' %}
>
> And this would use Django storage or S3, whatever.
I suspect that your proposal could be acceptable, if, instead of adding HTTP
sources into the templates, you added a "using=" argument that referenced a
file-storage object -- similar to the one on the cache tag.
The problem with this idea is that, while caches are named in a settings
entry, there is currently no such "registry" of file-storage objects. One could
arguably be added to staticfiles' AppConfig, but that will probably only happen
if there are more uses for named storages.
Anyway, doing it this way addresses Florian's concerns -- control of which
named storage goes where stays at the project level, the templates only
specify grouping of files; and I think it gives most of what you want.
The only concern I have about it is, it may be over-engineered -- in practice,
you don't usually have whole sets of files in different storages, and if you do,
you can probably tell the right storage by path; so a simpler solution is a
custom storage (as Florian pointed) which makes all the decisions.
YMMV,
Shai.