Collectstatic error while deploying Django app to Heroku

前端 未结 10 1930
长情又很酷
长情又很酷 2020-12-04 06:34

I\'m trying to deploy a Django app to Heroku, it starts to build, download and installs everything, but that\'s what I get when it comes to collecting static files



        
10条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-04 07:26

    You have STATICFILES_DIRS configured to expect a static directory in the same directory as your settings.py file, so make sure it's there not somewhere else.

    Also, do you have any files in that static directory? If you don't then git won't track it and so although it exists locally it won't exist in git. The usual solution to this is to create an empty file called .keep in the directory which will ensure that git tracks it. But once you have some static files in this directory then it won't be a problem anymore.

提交回复
热议问题