[Django] #32665: caches.W002 check does not support tuples in STATICFILES_DIRS

0 views
Skip to first unread message

Django

unread,
Apr 19, 2021, 4:35:47 PM4/19/21
to django-...@googlegroups.com
#32665: caches.W002 check does not support tuples in STATICFILES_DIRS
-----------------------------------------+------------------------
Reporter: jaredlockhart | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
The caches.W002 check defined here:

https://github.com/django/django/blob/76c0b32f826469320c59709d31e2f2126dd7c505/django/core/checks/caches.py#L22-L55

inspects the values of each entry in STATICFILES_DIRS here:

https://github.com/django/django/blob/76c0b32f826469320c59709d31e2f2126dd7c505/django/core/checks/caches.py#L30-L33

and passes them to pathlib.Path(staticfiles_dir) which expects a string,
however according to the documentation each entry in STATICFILES_DIRS may
be either a string or a tuple:

https://docs.djangoproject.com/en/3.2/ref/settings/#prefixes-optional

If a STATICFILES_DIRS entry is provided as a tuple, this check fails with:

TypeError: expected str, bytes or os.PathLike object, not tuple

in python3.9/pathlib.py in _parse_args at line 680

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

Django

unread,
Apr 20, 2021, 12:25:19 AM4/20/21
to django-...@googlegroups.com
#32665: caches.W002 check does not support tuples in STATICFILES_DIRS
--------------------------------------+------------------------------------
Reporter: Jared Lockhart | Owner: nobody
Type: Bug | Status: new
Component: Core (System checks) | Version: 3.2
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* severity: Normal => Release blocker
* cc: christa (added)
* component: Uncategorized => Core (System checks)
* easy: 0 => 1
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted


Comment:

Thanks for the report.

Regression in c36075ac1dddfa986340b1a5e15fe48833322372.
Reproduced at 413c15ef2e3d3958fb641a023bc1e2d15fb2b228.

--
Ticket URL: <https://code.djangoproject.com/ticket/32665#comment:1>

Django

unread,
Apr 20, 2021, 12:29:12 AM4/20/21
to django-...@googlegroups.com
#32665: caches.W002 check does not support tuples in STATICFILES_DIRS
--------------------------------------+------------------------------------
Reporter: Jared Lockhart | Owner: nobody
Type: Bug | Status: new
Component: Core (System checks) | Version: 3.2
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* Attachment "32665-tests.diff" added.

Regression tests.

Django

unread,
Apr 21, 2021, 1:21:47 AM4/21/21
to django-...@googlegroups.com
#32665: caches.W002 check does not support tuples in STATICFILES_DIRS
-------------------------------------+-------------------------------------
Reporter: Jared Lockhart | Owner: Mariusz
| Felisiak
Type: Bug | Status: assigned
Component: Core (System | Version: 3.2
checks) |

Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: nobody => Mariusz Felisiak
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/32665#comment:2>

Django

unread,
Apr 21, 2021, 1:41:19 AM4/21/21
to django-...@googlegroups.com
#32665: caches.W002 check does not support tuples in STATICFILES_DIRS
-------------------------------------+-------------------------------------
Reporter: Jared Lockhart | Owner: Mariusz
| Felisiak
Type: Bug | Status: assigned
Component: Core (System | Version: 3.2
checks) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/14291 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/32665#comment:3>

Django

unread,
Apr 21, 2021, 2:50:43 AM4/21/21
to django-...@googlegroups.com
#32665: caches.W002 check does not support tuples in STATICFILES_DIRS
-------------------------------------+-------------------------------------
Reporter: Jared Lockhart | Owner: Mariusz
| Felisiak
Type: Bug | Status: assigned
Component: Core (System | Version: 3.2
checks) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/32665#comment:4>

Django

unread,
Apr 21, 2021, 3:42:21 AM4/21/21
to django-...@googlegroups.com
#32665: caches.W002 check does not support tuples in STATICFILES_DIRS
-------------------------------------+-------------------------------------
Reporter: Jared Lockhart | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed

Component: Core (System | Version: 3.2
checks) |
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"34d1905712d33e72c76b3a55a4fc24abbd11be6c" 34d1905]:
{{{
#!CommitTicketReference repository=""
revision="34d1905712d33e72c76b3a55a4fc24abbd11be6c"
Fixed #32665 -- Fixed caches system check crash when STATICFILES_DIRS is a
list of 2-tuples.

Thanks Jared Lockhart for the report.

Regression in c36075ac1dddfa986340b1a5e15fe48833322372.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32665#comment:5>

Django

unread,
Apr 21, 2021, 3:43:56 AM4/21/21
to django-...@googlegroups.com
#32665: caches.W002 check does not support tuples in STATICFILES_DIRS
-------------------------------------+-------------------------------------
Reporter: Jared Lockhart | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed
Component: Core (System | Version: 3.2
checks) |
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"1cc2eaf02d2aa64f7ca4ef52f3d9f13381540007" 1cc2eaf0]:
{{{
#!CommitTicketReference repository=""
revision="1cc2eaf02d2aa64f7ca4ef52f3d9f13381540007"
[3.2.x] Fixed #32665 -- Fixed caches system check crash when


STATICFILES_DIRS is a list of 2-tuples.

Thanks Jared Lockhart for the report.

Regression in c36075ac1dddfa986340b1a5e15fe48833322372.
Backport of 34d1905712d33e72c76b3a55a4fc24abbd11be6c from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32665#comment:6>

Reply all
Reply to author
Forward
0 new messages