Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collectstatic fails if CSS mentions an image file not in /static/ #70

Open
philipn opened this issue Jan 26, 2015 · 3 comments
Open

collectstatic fails if CSS mentions an image file not in /static/ #70

philipn opened this issue Jan 26, 2015 · 3 comments

Comments

@philipn
Copy link
Member

philipn commented Jan 26, 2015

From @mivanov on August 22, 2012 20:49

Traceback after running collectstatic command:

Post-processed 'js/ckeditor/_samples/sample.css' as 'js/ckeditor/_samples/sample.73029ced5a94.css
Post-processed 'openlayers/theme/sapling/framedCloud.css' as 'openlayers/theme/sapling/framedCloud.d41d8cd98f00.css
Post-processed 'openlayers/theme/sapling/google.css' as 'openlayers/theme/sapling/google.a2e579db8ee8.css
Post-processed 'openlayers/theme/sapling/ie6-style.css' as 'openlayers/theme/sapling/ie6-style.af81e35e0dc2.css
Post-processed 'openlayers/theme/sapling/style.css' as 'openlayers/theme/sapling/style.2691bb9f9e74.css
Post-processed 'js/ckeditor/tests/qunit.css' as 'js/ckeditor/tests/qunit.37a4c1112878.css
Post-processed 'tagedit/css/ui-lightness/jquery-ui-1.8.6.custom.css' as 'tagedit/css/ui-lightness/jquery-ui-1.8.6.custom.8017548112e7.css
Traceback (most recent call last):
  File "/srv/sites/detroit/env/bin/localwiki-manage", line 8, in <module>
    load_entry_point('localwiki==0.4.0', 'console_scripts', 'localwiki-manage')()
  File "/srv/sites/detroit/env/lib/python2.6/site-packages/localwiki-0.4.0-py2.6.egg/sapling/manage.py", line 57, in main
    execute_manager(settings)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/usr/local/lib/python2.6/dist-packages/django_staticfiles-1.2.1-py2.6.egg/staticfiles/management/commands/collectstatic.py", line 163, in handle_noargs
    collected = self.collect()
  File "/usr/local/lib/python2.6/dist-packages/django_staticfiles-1.2.1-py2.6.egg/staticfiles/management/commands/collectstatic.py", line 120, in collect
    for original_path, processed_path, processed in processor:
  File "/usr/local/lib/python2.6/dist-packages/django_staticfiles-1.2.1-py2.6.egg/staticfiles/storage.py", line 270, in post_process
    content = pattern.sub(converter, content)
  File "/usr/local/lib/python2.6/dist-packages/django_staticfiles-1.2.1-py2.6.egg/staticfiles/storage.py", line 213, in converter
    hashed_url = self.url(unquote(joined_result), force=True)
  File "/usr/local/lib/python2.6/dist-packages/django_staticfiles-1.2.1-py2.6.egg/staticfiles/storage.py", line 160, in url
    hashed_name = self.hashed_name(clean_name).replace('\\', '/')
  File "/usr/local/lib/python2.6/dist-packages/django_staticfiles-1.2.1-py2.6.egg/staticfiles/storage.py", line 123, in hashed_name
    (clean_name, self))
ValueError: The file '_files/welcome.jpg' could not be found with <staticfiles.storage.CachedStaticFilesStorage object at 0x2e161d0>.

Trying to find what's causing this...

(env)root@localwiki:/srv/sites/detroit/env/share/localwiki/themes/sapling-detroit# grep -R welcome.jpg *
assets/css/detroit.css: background-image: url(/front_page/_files/welcome.jpg);

So the most likely cause is this file.

Copied from original issue: localwiki/localwiki#326

@philipn
Copy link
Member Author

philipn commented Jan 26, 2015

jezdez/django-staticfiles#17
localwiki/localwiki#146 (unrelated i think)

@philipn
Copy link
Member Author

philipn commented Jan 26, 2015

From @mivanov on August 22, 2012 21:2

Yep #146 is unrelated, but we should use that patch.

@philipn
Copy link
Member Author

philipn commented Jan 26, 2015

From @peterldowns on February 15, 2013 8:10

I'm having a very similar problem (background-image: url(/images/frontpage/seperator.png) leads to an error saying that frontpage/seperator.png can't be found -- somehow dropping the /images/ prefix) in one of my own django projects. @mivanov, did you ever manage to resolve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant