Opened 6 days ago

Last modified 6 days ago

#35822 closed Bug

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

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 (last modified by Sarah Boyce)

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

    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 (1)

comment:1 by Sarah Boyce, 6 days ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top