Opened 5 weeks ago

Last modified 5 weeks ago

#35822 closed Bug

App name hard-coded in collectstatic command forces name of overriding app name to be 'staticfiles' — at Initial Version

Reported by: fishfin Owned by:
Component: contrib.staticfiles Version: 5.1
Severity: Normal Keywords: collectstatic
Cc: fishfin Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In django.contrib.staticfiles.management.commands.collectstatic, Command.set_options(), there is:
`python

ignore_patterns += apps.get_app_config("staticfiles").ignore_patterns

`
This looks for config class StaticFilesConfig in the app trying to overwrite ignore_patterns. Because Django forces the class name to match config name (in this case StaticFiles, the name of the app is forced to be staticfiles, it cannot be anything else. Either the hard-coding in collectstatic command set_options() should be changed, or document at https://docs.djangoproject.com/en/5.1/ref/contrib/staticfiles/#customizing-the-ignored-pattern-list should be changed for the example which shows the Config can be named MyStaticFilesConfig, which is clearly cannot be.

I have just started on Django (3-4 months) and I have looked at number of places, this info is missing, hence raising this ticket.

Change History (0)

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