[Django] #31000: Match @import rule and url() statement exclude of the css comment /* */ in the css file source code, during the run collectstatic command

8 views
Skip to first unread message

Django

unread,
Nov 18, 2019, 1:59:38 PM11/18/19
to django-...@googlegroups.com
#31000: Match @import rule and url() statement exclude of the css comment /* */ in
the css file source code, during the run collectstatic command
-------------------------------------+-------------------------------------
Reporter: Tomáš | Owner: nobody
Zigo |
Type: | Status: new
Uncategorized |
Component: | Version: 2.2
contrib.staticfiles | Keywords: staticfiles,
Severity: Normal | collectstatic
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I use some extrenal js lib assets in the my django project (automatically
installed by the bower js package manager).

Some css source code has {{{url()}}} statement inside the comment {{{/*
*/}}} with wrong relatative path to img/font.

During running command {{{python manage.py collectstatic}}} I get error
message.
{{{
Traceback (most recent call last):
File "manage.py", line 26, in <module>
execute_from_command_line(sys.argv)
File "/home/test/.local/share/virtualenvs/klub-v-nnivlwsY/lib/python3.6
/site-packages/django/core/management/__init__.py", line 381, in
execute_from_command_line
utility.execute()
File "/home/test/.local/share/virtualenvs/klub-v-nnivlwsY/lib/python3.6
/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/test/.local/share/virtualenvs/klub-v-nnivlwsY/lib/python3.6
/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/test/.local/share/virtualenvs/klub-v-nnivlwsY/lib/python3.6
/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/home/test/.local/share/virtualenvs/klub-v-nnivlwsY/lib/python3.6
/site-
packages/django/contrib/staticfiles/management/commands/collectstatic.py",
line 188, in handle
collected = self.collect()
File "/home/test/.local/share/virtualenvs/klub-v-nnivlwsY/lib/python3.6
/site-
packages/django/contrib/staticfiles/management/commands/collectstatic.py",
line 134, in collect
raise processed
whitenoise.storage.MissingFileError: The file 'colorPicker/_blank.gif'
could not be found with
<whitenoise.storage.CompressedManifestStaticFilesStorage object at
0x7fe6c456c8d0>.

The CSS file 'colorPicker/index.css' references a file which could not be
found:
colorPicker/_blank.gif

Please check the URL references in this CSS file, particularly any
relative paths which might be pointing to the wrong location.
}}}

{{{ url('_blank.gif') }}} statement is inside comment in the css source
code.

Problem is that {{{@import}}} rule and {{{url()}}} statement are checked
in all css file source code content, include code between css comment
{{{/* */}}}.
( regex pattern for the match rule/statement {{{
django.contrib.staticfiles.storage.HashedFilesMixin.patterns}}})

I write patch which match this rule and statement only outside of the css
comment in css file source code.

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

Django

unread,
Nov 18, 2019, 3:33:08 PM11/18/19
to django-...@googlegroups.com
#31000: Match @import rule and url() statement exclude of the css comment /* */ in
the css file source code, during the run collectstatic command
-------------------------------------+-------------------------------------
Reporter: Tomáš Zigo | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.staticfiles | Version: 2.2
Severity: Normal | Resolution:
Keywords: staticfiles, | Triage Stage:
collectstatic | Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Tomáš Zigo:

Old description:

New description:

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

--

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

Django

unread,
Nov 18, 2019, 3:50:28 PM11/18/19
to django-...@googlegroups.com
#31000: Match @import rule and url() statement exclude of the css comment /* */ in
the css file source code, during the run collectstatic command
-------------------------------------+-------------------------------------
Reporter: Tomáš Zigo | Owner: nobody
Type: Bug | Status: closed
Component: contrib.staticfiles | Version: master
Severity: Normal | Resolution: duplicate

Keywords: staticfiles, | Triage Stage:
collectstatic | Unreviewed
Has patch: 1 | Needs documentation: 0

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

* status: new => closed
* resolution: => duplicate
* version: 2.2 => master
* type: Uncategorized => Bug


Comment:

Duplicate of #21080.

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

Django

unread,
Nov 18, 2019, 3:52:00 PM11/18/19
to django-...@googlegroups.com
#31000: Match @import rule and url() statement exclude of the css comment during
the collectstatic.

-------------------------------------+-------------------------------------
Reporter: Tomáš Zigo | Owner: nobody
Type: Bug | Status: closed
Component: contrib.staticfiles | Version: master
Severity: Normal | Resolution: duplicate
Keywords: staticfiles, | Triage Stage:
collectstatic | Unreviewed
Has patch: 1 | Needs documentation: 0

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

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

Reply all
Reply to author
Forward
0 new messages