按教程将项目推送到heroku,前面步骤一切顺利没有任何错误,直到这里出现问题在网上没有找到解决方法。。。感觉好像是setting.py的设置有问题,但和教程里对照是一样的:heroku的设置ifos.getcwd()=='/app':importdj_database_urlDATABASES={'default':dj_database_url.config(default='postgres://localhost')}SECURY_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTO','https')ALLOWED_HOSTS=['*']BASE_DIR=os.path.dirname(os.path.abspath(__file__))STATIC_ROOT='staticfiles'STATICFILES_DIRS=(os.path.join(BASE_DIR,'static'),)命令行的报错:(ll_env)G:python_dorest>herokucreateCreatingapp...done,protected-crag-1803https://protected-crag-1803.h...|https://git.heroku.com/protec...(ll_env)G:python_dorest>gitpushherokumasterCountingobjects:48,done.Deltacompressionusingupto4threads.Compressingobjects:100%(39/39),done.Writingobjects:100%(48/48),11.18KiB|0bytes/s,done.Total48(delta3),reused0(delta0)remote:Compressingsourcefiles...done.remote:Buildingsource:remote:remote:----->Pythonappdetectedremote:----->Installingpython-3.5.2—————————中间内容省略—————————remote:File"/app/.heroku/python/lib/python3.5/site-packages/django/contrib/staticfiles/storage.py",line50,inpathremote:raiseImproperlyConfigured("You'reusingthestaticfilesapp"remote:django.core.exceptions.ImproperlyConfigured:You'reusingthestaticfilesappwithouthavingsettheSTATIC_ROOTsettingtoafilesystempath.remote:remote:!Errorwhilerunning'$pythonmanage.pycollectstatic--noinput'.remote:Seetracebackabovefordetails.remote:remote:Youmayneedtoupdateapplicationcodetoresolvethiserror.remote:Or,youcandisablecollectstaticforthisapplication:remote:remote:$herokuconfig:setDISABLE_COLLECTSTATIC=1remote:remote:https://devcenter.heroku.com/...remote:!Pushrejected,failedtocompilePythonapp.remote:remote:!Pushfailedremote:Verifyingdeploy...remote:remote:!Pushrejectedtoprotected-crag-1803.remote:Tohttps://git.heroku.com/protec...![remoterejected]master->master(pre-receivehookdeclined)error:failedtopushsomerefsto'https://git.heroku.com/protec...'
2 回答
蝴蝶不菲
TA贡献1810条经验 获得超4个赞
Youmayneedtoupdateapplicationcodetoresolvethiserror.remote:Or,youcandisablecollectstaticforthisapplication:remote:remote:$herokuconfig:setDISABLE_COLLECTSTATIC=1显示可能是heroku服务器已经有一个静态文件占位了,所以要删掉它。执行命令:herokuconfig:setDISABLE_COLLECTSTATIC=0我也遇到了同样的问题,用这种方法解决了,希望能帮助你和后来者~
添加回答
举报
0/150
提交
取消
