Opened 12 years ago
Closed 9 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)
Change History (11)
comment:1 by , 12 years ago
comment:2 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
by , 11 years ago
Attachment: | ticket-20189.patch added |
---|
Added STATICFILES_IGNORE_PATTERNS to settings.
comment:3 by , 11 years ago
Cc: | added |
---|---|
Has patch: | set |
Version: | 1.5 → master |
comment:4 by , 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 , 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 , 10 years ago
Patch needs improvement: | unset |
---|
Patch updated, see PR https://github.com/django/django/pull/2854
comment:7 by , 10 years ago
Patch needs improvement: | set |
---|
This is simple, don't add a global setting but a parameter to the staticfile app config. That's where such things belong now.
comment:8 by , 9 years ago
Patch needs improvement: | unset |
---|
Tried to provide a new PR with the app config way.
comment:9 by , 9 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
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.