You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Django开发App时遇ValueError:无法加载staticfiles.json清单求助

Django静态文件Manifest加载失败问题求助

部署Django应用时触发Internal Server Error,核心错误为ValueError: Couldn't load manifest '%s' (version %s),完整报错栈如下:

Internal Server Error: /
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/abolfazl/socialmedia/core/views.py", line 6, in index
    return render(request, 'index.html')
  File "/usr/local/lib/python3.10/dist-packages/django/shortcuts.py", line 19, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "/usr/local/lib/python3.10/dist-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "/usr/local/lib/python3.10/dist-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/usr/local/lib/python3.10/dist-packages/django/template/base.py", line 170, in render
    return self._render(context)
  File "/usr/local/lib/python3.10/dist-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/usr/local/lib/python3.10/dist-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/usr/local/lib/python3.10/dist-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/usr/local/lib/python3.10/dist-packages/django/templatetags/static.py", line 106, in render
    url = self.url(context)
  File "/usr/local/lib/python3.10/dist-packages/django/templatetags/static.py", line 103, in url
    return self.handle_simple(path)
  File "/usr/local/lib/python3.10/dist-packages/django/templatetags/static.py", line 118, in handle_simple
    return staticfiles_storage.url(path)
  File "/usr/local/lib/python3.10/dist-packages/django/utils/functional.py", line 246, in inner
    self._setup()
  File "/usr/local/lib/python3.10/dist-packages/django/contrib/staticfiles/storage.py", line 438, in _setup
    self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()
  File "/home/abolfazl/.local/lib/python3.10/site-packages/whitenoise/storage.py", line 131, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/django/contrib/staticfiles/storage.py", line 373, in __init__
    self.hashed_files = self.load_manifest()
  File "/usr/local/lib/python3.10/dist-packages/django/contrib/staticfiles/storage.py", line 394, in load_manifest
    raise ValueError("Couldn't load manifest '%s' (version %s)" %

已尝试多种网络上的解决方案,仍未解决,求可行修复方案。


可能的修复方向:

  • 检查STATIC_ROOT目录是否存在,确认collectstatic命令已成功执行,验证staticfiles.json(或指定的manifest文件)生成在正确路径
  • 核对settings.py中STATICFILES_STORAGE配置,若使用Whitenoise,确保其版本与当前Django版本兼容
  • 清理旧的manifest文件,执行python manage.py collectstatic --clear强制生成新的静态文件清单
  • 检查部署环境的文件权限,确保Django进程拥有读取STATIC_ROOT目录及manifest文件的权限
  • 若使用版本控制,确认manifest文件已正确部署到生产环境,未被.gitignore规则忽略

内容的提问来源于stack exchange,提问作者Abol

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 07:54:54