#35822: App name hard-coded in collectstatic command forces name of overriding 
app
name to be 'staticfiles'
-------------------------------------+-------------------------------------
     Reporter:  fishfin              |                    Owner:  (none)
         Type:  Bug                  |                   Status:  new
    Component:  contrib.staticfiles  |                  Version:  5.1
     Severity:  Normal               |               Resolution:
     Keywords:  collectstatic        |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Sarah Boyce:

Old 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.

New 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.

--
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35822#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701926fc44893-9868d23b-636c-45b2-9a9c-af35da2e177e-000000%40eu-central-1.amazonses.com.

Reply via email to