gpt4 book ai didi

python - 启用 WhiteNoise 时,“collectstatic”命令失败

转载 作者:IT老高 更新时间:2023-10-28 20:26:34 26 4
gpt4 key购买 nike

我正在尝试通过 WhiteNoise 提供静态文件根据 Heroku的推荐。当我在开发环境中运行 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。如果它找不到文件,它会因该错误而停止。

关于python - 启用 WhiteNoise 时,“collectstatic”命令失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26829435/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com