Opened 10 years ago

Closed 16 months ago

#23563 closed Cleanup/optimization (fixed)

Make `staticfiles_storage` a public API

Reported by: Aymeric Augustin Owned by: Pablo Montepagano
Component: Documentation Version: 1.7
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

This is a follow-up ticket to #23506, focused on the part of the problem I believe we need to solve.

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 url method.

Change History (4)

comment:1 by Tim Graham, 10 years ago

Component: contrib.staticfilesDocumentation
Needs documentation: unset
Triage Stage: UnreviewedAccepted

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.

comment:2 by Mariusz Felisiak, 23 months ago

Easy pickings: set

comment:3 by Pablo Montepagano, 23 months ago

Owner: changed from nobody to Pablo Montepagano
Status: newassigned

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.

in reply to:  3 comment:4 by Mariusz Felisiak, 16 months ago

Resolution: fixed
Status: assignedclosed

Replying to 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.

Note: See TracTickets for help on using tickets.
Back to Top