#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:
> 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.
New description:
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.
[https://github.com/django/django/pull/12104 PR]
--
--
Ticket URL: <https://code.djangoproject.com/ticket/31000#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/063.c383f9989b01bb11d2239ea65461707a%40djangoproject.com.