Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#14693 closed (fixed)

staticfiles app doesn't work with form media framework and 3rd party asset managers

Reported by: Jannis Leidel Owned by: nobody
Component: Contrib apps Version: 1.3-alpha
Severity: Keywords:
Cc: oleg.lomaka@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

As discussed with Russell and Carl on IRC (after quite some feedback on the mailing list), the current proposal to fix this is:

  • Introduce new core settings: STATIC_URL, STATIC_ROOT (which refer to non-user files, canonical setting for root of all static content)
  • form media and admin are modified to use this instead (starting to deprecate ADMIN_MEDIA_PREFIX?)
  • staticfiles app uses it too, as a replacement for its current STATICFILES_URL, STATICFILES_ROOT (this is actually compaptible with the original 3rd party staticfiles app)
  • for existing projects we keep defaulting form media to MEDIA_URL and have checks ready for the migrated projects
  • new projects automatically enable staticfiles app and aren't problematic

Attachments (4)

14693.1.diff (36.1 KB ) - added by Jannis Leidel 14 years ago.
Initial patch
14693.2.diff (49.1 KB ) - added by Jannis Leidel 14 years ago.
Moved context processors and template tags to core since those settings are core settings.
14693.2.2.diff (49.2 KB ) - added by Jannis Leidel 14 years ago.
Moved context processors and template tags to core since those settings are core settings.
14693.3.diff (83.1 KB ) - added by Jannis Leidel 14 years ago.
Final patch

Download all attachments as: .zip

Change History (8)

by Jannis Leidel, 14 years ago

Attachment: 14693.1.diff added

Initial patch

comment:1 by Carl Meyer, 14 years ago

Triage Stage: UnreviewedAccepted

Patch looks good. A couple notes:

  1. It looks like the get_staticfiles_prefix tag was removed completely (which is fine with me, tbh), but the docs reference a "get_static_prefix" tag, which I don't see.
  1. If STATIC_* are core settings now, should the static context processor move to core rather than staticfiles? I think it should.

comment:2 by Oleg Lomaka, 14 years ago

Cc: oleg.lomaka@… added

by Jannis Leidel, 14 years ago

Attachment: 14693.2.diff added

Moved context processors and template tags to core since those settings are core settings.

by Jannis Leidel, 14 years ago

Attachment: 14693.2.2.diff added

Moved context processors and template tags to core since those settings are core settings.

by Jannis Leidel, 14 years ago

Attachment: 14693.3.diff added

Final patch

comment:3 by Jannis Leidel, 14 years ago

Resolution: fixed
Status: newclosed

(In [14592]) Fixed #14693, #14709 -- Backwards incompatible change to rectify the confusion around the STATICFILES_URL and STATICFILES_ROOT settings.

  • Two new global settings that will be used by -- but are not limited to -- the staticfiles app: STATIC_ROOT and STATIC_URL.
  • Moving the 'django.contrib.staticfiles.templatetags.staticfiles' template tag to the core ('django.templatetags.static') and renaming it to 'get_static_prefix'.
  • Moving the context processor 'django.contrib.staticfiles.context_processors.staticfiles' to the core ('django.core.context_processors.static') and renaming it to 'static'.
  • Paths in media definitions will use STATIC_URL as the prefix if the value is not None, and falls back to the previously used MEDIA_URL.

Thanks again to the community for constructive criticism and Carl and Russ for sanity-inducing discussions on IRC.

comment:4 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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