首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >由于静态文件收集原因而被Heroku拒绝

由于静态文件收集原因而被Heroku拒绝
EN

Stack Overflow用户
提问于 2018-05-16 12:51:59
回答 1查看 188关注 0票数 2

当我试图将Django应用程序部署到Heroku时,会遇到与python -将Django应用程序部署到Heroku - Stack溢出时发生的集合静态错误相同的问题

它开始构建、下载和安装所有东西,但这正是我在收集静态文件时得到的:

代码语言:javascript
复制
$ 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:        https://devcenter.heroku.com/articles/django-assets
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'

我试过了所有的答案,但没有帮助。另外,我尝试使用Django和静态资产- Heroku开发中心配置设置并安装whitenoise并提交更改。

这个问题没有得到解决。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-05-16 12:57:22

禁用自动收藏:

代码语言:javascript
复制
heroku config:set DISABLE_COLLECTSTATIC=1

然后把你的项目推给heroku。完成部署后,手动收集如下所示:

代码语言:javascript
复制
heroku run python manage.py collectstatic

如果仍然有错误,您的静态文件配置可能是原因。试着简化它,删除whitenoise,例如使用一个s3桶。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50371475

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档