部署Django应用到Heroku时collectstatic报错,推送被拒绝
Django部署Heroku时Collectstatic报错,已尝试常见方案仍未解决
我正在将Django应用部署到Heroku的过程中,遇到了collectstatic阶段的报错,和社区里一篇关于该问题的经典帖子情况完全一致。整个构建、依赖下载及安装流程都顺利完成,但在执行静态文件收集步骤时失败,具体报错日志如下:
$ git push heroku master Counting objects: 5375, done. Total 5375 (delta 1092), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Python app detected remote: -----> Installing requirements with pip remote: ... remote: remote: ! Error while running '$ python manage.py collectstatic --noinput'. remote: See traceback above for details. remote: remote: You may need to update application code to resolve this error. remote: Or, you can disable collectstatic for this application: remote: remote: $ heroku config:set DISABLE_COLLECTSTATIC=1 remote: remote: ! Push rejected, failed to compile Python app. remote: remote: ! Push failed remote: Verifying deploy.... remote: remote: ! Push rejected to fierce-cove-94300. remote: To https://git.heroku.com/fierce-cove-94300.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/fierce-cove-94300.git'
我已经尝试了以下方案,但问题仍然没有解决:
- 完全照搬了那篇经典帖子里的所有解决方案
- 参照Heroku开发者中心的Django静态资源配置文档,完成了相关设置并安装了
whitenoise库 - 提交所有修改后重新推送部署,报错依旧出现
内容的提问来源于stack exchange,提问作者Wizard
相关产品推荐
相关产品推荐

