当前位置: 首页 > 面试题库 >

启用WhiteNoise后,“ collectstatic”命令失败

薛焱
2023-03-14
问题内容

我试图按照Heroku的建议通过WhiteNoise提供静态文件。当我在开发环境中运行时,会发生以下情况:collectstatic

Post-processing 'css/iconic/open-iconic-bootstrap.css' failed!

Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/core/management/base.py", line 533, in handle
    return self.handle_noargs(**options)
  File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle_noargs
    collected = self.collect()
  File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 120, in collect
    raise processed
  File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/contrib/staticfiles/storage.py", line 242, in post_process
    content = pattern.sub(converter, content)
  File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/contrib/staticfiles/storage.py", line 181, in converter
    hashed_url = self.url(unquote(joined_result), force=True)
  File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/contrib/staticfiles/storage.py", line 128, in url
    hashed_name = self.stored_name(clean_name)
  File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/contrib/staticfiles/storage.py", line 277, in stored_name
    cache_name = self.clean_name(self.hashed_name(name))
  File "/home/Pieter/.virtualenvs/radiant/lib/python3.4/site-packages/django/contrib/staticfiles/storage.py", line 91, in hashed_name
    (clean_name, self))
ValueError: The file 'css/fonts/open-iconic.eot' could not be found with <whitenoise.django.GzipManifestStaticFilesStorage object at 0x7f57fc5b1550>.

当我在设置中将此行注释掉时,静态收集命令运行不会发生意外:

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

这里出了什么问题,我该如何解决?我已经尝试清空静态文件输出文件夹。它运行平稳,直到开始处理一个特定文件为止。


问题答案:

这里的问题css/iconic/open-iconic-bootstrap.css是引用文件open-iconic.eot,该文件在预期位置不存在。

当您collectstatic使用该存储后端运行时,Django会尝试重写CSS文件中的所有URL,以便它们以新名称(例如)引用文件css/iconic/open- iconic.8a7442ca6bed.eot。如果找不到文件,它将停止并显示该错误。



 类似资料:
  • 处理这些网络管理员:用户名:admin ✖创业网络定义。这可能需要一分钟...错误:尝试启动业务网络时出错。错误:没有来自任何对等点的有效响应。尝试对等通信的响应是错误:错误:未能执行事务AE276DA81F756AC76EDCCF85A79F1C11A554F1285C2A8C4CC2899DB433220500:启动容器错误:启动容器错误:未能生成特定于平台的docker构建:从构建返回的错误

  • 问题内容: 我是高级新手,请多多包涵。 我已经从另一位工程师那里继承了python脚本。为了方便起见,我希望能够从Windows bat文件启动脚本,但最初尝试通过从Windows命令行运行进行调试。 每当我从CMD启动脚本时,它似乎都可以启动,然后立即因错误而失败。 我的环境:Windows7 Pro和Windows10 Pro(发生相同的错误),Anaconda 3.7,Spyder 3.3.

  • 这在我的朋友的机器上运行良好,有相同的版本。请帮帮忙。

  • 我使用android studio preview beta 4,打开project it build时从https://github.com/drklo/Telegram获得Telegram源代码,并出现以下错误: 我使用最新的NDK android-ndk-r16-beta1-windows-x86。add-application.mk的第100行中有错误,它是: 所以我使用的add-appl

  • 有人能帮我解决这个错误吗? 我把ADS放在我的项目中,当我尝试将我的项目构建到Android时,我得到了这个错误。 但是,如果我将ADS脱机,那么错误就会消失。 命令调用失败:Gradle 构建失败。C:/Program Files/Java/jdk1.8.0_45\bin\java.exe -classpath “E:\unity 5\Editor\Data\PlaybackEngines\An

  • 我为考试写的贝娄类: 公共类测试应用程序 {AppiumDriver驱动程序; 信息:<--POST/wd/hub/session 500 210 49.722ms-1390 谢谢你帮我解决这件事。谢谢你