Django should provide a way to obtain the URL of static files other than
the `{% static %}` template tag. I haven't found one in the docs.
I think the easiest solution is to make
`django.contrib.staticfiles.storage.staticfiles_storage` a public API and
document that it implements the file storage API, especially the
[https://docs.djangoproject.com/en/1.7/ref/files/storage/#django.core.files.storage.Storage.url
url] method.
--
Ticket URL: <https://code.djangoproject.com/ticket/23563>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_docs: 1 => 0
* component: contrib.staticfiles => Documentation
* stage: Unreviewed => Accepted
Comment:
For this it would be helpful to point to `docs/howto/custom-file-
storage.txt` which lists the usual methods for storage classes. For
example, `staticfiles_storage.url('foo.js')` works to get URL.
--
Ticket URL: <https://code.djangoproject.com/ticket/23563#comment:1>
* easy: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/23563#comment:2>
* owner: nobody => Pablo Montepagano
* status: new => assigned
Comment:
I don't believe there's much improvement to be made here. In the section
"Other Helpers" of `docs/ref/contrib/staticfiles.txt` we already have this
sentence:
The builtin template tag `static` which takes a path and urljoins it
with the static prefix `STATIC_URL`. If `django.contrib.staticfiles` is
installed, the tag uses the `url()` method of the `STATICFILES_STORAGE`
instead.
--
Ticket URL: <https://code.djangoproject.com/ticket/23563#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
Replying to [comment:3 Pablo Montepagano]:
> I don't believe there's much improvement to be made here. In the section
"Other Helpers" of `docs/ref/contrib/staticfiles.txt` we already have this
sentence:
>
> The builtin template tag `static` which takes a path and urljoins it
with the static prefix `STATIC_URL`. If `django.contrib.staticfiles` is
installed, the tag uses the `url()` method of the `STATICFILES_STORAGE`
instead.
Agreed, this has already been documented in
cf546e11ac76c8dec527e39ff8ce8249a195ab42.
--
Ticket URL: <https://code.djangoproject.com/ticket/23563#comment:4>