Collectstatic error while deploying Django app to Heroku

前端 未结 10 1828
长情又很酷
长情又很酷 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:31

    This worked for me:

    step 1 - heroku config:set DISABLE_COLLECTSTATIC=1
    step 2 - git push heroku master

    0 讨论(0)
  • 2020-12-04 07:31

    It seems to me that it's having problems creating that blogproject/static folder. I see you have a static folder inside your blog app, but it should be up one level in your blogproject folder.

    Try creating a static folder inside your blogproject folder and that error should go away.

    0 讨论(0)
  • 2020-12-04 07:37

    I just updated to Django 1.10 today and had the exact same problem. Your static settings are identical to mine as well.

    This worked for me, run the following commands:

    1. disable the collectstatic during a deploy

      heroku config:set DISABLE_COLLECTSTATIC=1

    2. deploy

      git push heroku master

    3. run migrations (django 1.10 added at least one)

      heroku run python manage.py migrate

    4. run collectstatic using bower

      heroku run 'bower install --config.interactive=false;grunt prep;python manage.py collectstatic --noinput'

    5. enable collecstatic for future deploys

      heroku config:unset DISABLE_COLLECTSTATIC

    6. try it on your own (optional)

      heroku run python manage.py collectstatic

    future deploys should work as normal from now on

    0 讨论(0)
  • 2020-12-04 07:38

    I face same problem..

    Follow this step

    1. heroku config:set DISABLE_COLLECTSTATIC=1
    2. git push heroku master
    3. python manage.py collectstatic
    4. python manage.py test
    5. If any error occurred after running test..check your STATIC_ROOT is correct like this ==> STATIC_ROOT = os.path.join(BASE_DIR, 'static').
    6. After run collectstatic command check all static files are store in static directory for your root dir. level(manage.py dir. level)...
    7. heroku run python manage.py collectstatic.
    8. heroku run python manage.py migrate
    9. heroku config:unset DISABLE_COLLECTSTATIC (for future use).
    0 讨论(0)
提交回复
热议问题