Opened 11 years ago

Closed 8 years ago

#20189 closed New feature (fixed)

Collectstatic ignore list expansion on a per project basis

Reported by: Mark Jones Owned by: nobody
Component: contrib.staticfiles Version: dev
Severity: Normal Keywords:
Cc: tomas.ehrlich@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently collectstatic gets its default ignores from this code.

        ignore_patterns = options['ignore_patterns']
        if options['use_default_ignore_patterns']:
            ignore_patterns += ['CVS', '.*', '*~']

In some of my projects I need more than this, and the only way to get that behavior is to remember the command line options and patterns. Working on many different projects all the time, this is problematic for me.

I'd like to propose a settings file addition that would pull those ignore patterns from settings.COLLECT_STATIC_IGNORE or something similar.

I'd be willing to write the code if this is accepted. We could leave the default alone, but allow people to put various things in the list to make deployment less of a hassle.

Part of the issues for me include sass files, themes associated with sass files, "uncompiled" javascript that needs to be served on debug, but does not need to be in the production static folder.

Attachments (1)

ticket-20189.patch (3.6 KB ) - added by Tomáš Ehrlich 11 years ago.
Added STATICFILES_IGNORE_PATTERNS to settings.

Download all attachments as: .zip

Change History (11)

comment:1 by Tomas Krajca, 11 years ago

Hi,

This is the file that the code is in https://github.com/django/django/blob/master/django/contrib/staticfiles/management/commands/collectstatic.py

This seems like a cool feature to me.

comment:2 by Kamu, 11 years ago

Triage Stage: UnreviewedAccepted

by Tomáš Ehrlich, 11 years ago

Attachment: ticket-20189.patch added

Added STATICFILES_IGNORE_PATTERNS to settings.

comment:3 by Tomáš Ehrlich, 11 years ago

Cc: tomas.ehrlich@… added
Has patch: set
Version: 1.5master

comment:4 by Tomáš Ehrlich, 11 years ago

I've added STATICFILES_IGNORE_PATTERNS setting. Implementation was mostly straightforward. The only problem is backward compatibility.

The default value of STATICFILES_IGNORE_PATTERNS is ['CVS', '.*', '*~'], the same as default patterns hard-coded in management command. When user passes --no-default-ignore option, these default patterns are substracted and deprecation warning raised.

Need review for this, also for docs. Tests passed.

comment:5 by Tim Graham, 10 years ago

Patch needs improvement: set

We try to avoid new settings at all costs, although I don't have any alternate suggestions in this case. Anyway, the patch needs to be updated.

comment:6 by Tomáš Ehrlich, 10 years ago

Patch needs improvement: unset

comment:7 by Jannis Leidel, 10 years ago

Patch needs improvement: set

This is simple, don't add a global setting but a parameter to the staticfiles app config. That's where such things belong now.

Last edited 10 years ago by Jannis Leidel (previous) (diff)

comment:8 by Claude Paroz, 8 years ago

Patch needs improvement: unset

Tried to provide a new PR with the app config way.

comment:9 by Tim Graham, 8 years ago

Triage Stage: AcceptedReady for checkin

comment:10 by Claude Paroz <claude@…>, 8 years ago

Resolution: fixed
Status: newclosed

In f4c2b8e:

Fixed #20189 -- Allowed customizing staticfiles ignored_patterns list

Thanks Tim Graham for the review.

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