Open fredj opened 9 years ago
I'm no longer clear on the advantages of using static_url
(or static_path
) for generating static URLs. What do you think?
Also, for example, if we want to generate a static URL for
"/node_modules/angular-gettext/dist/angular-gettext.js"
we will have to use something like this:
"${request.static_path('%s/angular-gettext/dist/angular-gettext.js' % request.registry.settings.get('node_modules_path'))}"
which is not very convenient. And I don't see what it gives us really.
Interested in your opinion about this.
This is what the Pyramid docs say:
« One benefit of using the static_url() function rather than constructing static URLs "by hand" is that if you need to change the name of a static URL declaration, the generated URLs will continue to resolve properly after the rename. »
I'm not convinced. What about the case where the file system path (instead of the name of the static view) changes? In that case you're a in better situation if you constructed your URL "by hand".
I'm not convinced either but absolute paths may cause some issue when the project will be served by apache: the "base url" may be something like: http://www.example.com/fredj/test/
and the absolute paths will no longer work
http://docs.pylonsproject.org/docs/pyramid/en/latest/narr/assets.html#static-assets-section