Heroku app crashed after pushing small change. Very confused

前端 未结 3 1173
面向向阳花
面向向阳花 2021-01-12 15:47

I am using Heroku with python and Flask. My app was working fine until I updated a few lines in my python application file. The app runs fine locally, but I now have the fol

3条回答
  •  爱一瞬间的悲伤
    2021-01-12 15:58

    I experienced a very similar problem yesterday (6th Dec. 2012). Out of the blue, every python invocation died with 'ImportError: No module named site'. Heroku support got back to me today and they say it's fixed on their end, so the following workaround shouldn't be required. I'll leave this here in case it helps someone else diagnose.

    I checked my heroku config vars though, and there were no PYTHON* variables set. They were set as env vars at the shell level though:

    $ heroku run set | grep PYTHON
    PYTHONHASHSEED=random
    PYTHONHOME=/app/.heroku/venv/
    PYTHONPATH=/app/
    PYTHONUNBUFFERED=true 
    

    /app/.heroku/venv was a non-existent directory. If I overrode PYTHONHOME with a config var, and pointed to where my virtualenv actually was, it all started working again:

    $ heroku config:set PYTHONHOME=/app
    

    /app appears to be a mount point for the project root directory. Digging through the history of the Python buildpack, it looks like when I started my project, everyone made their virtualenvs in the project root. Now new projects make virtualenvs in a venv/ subdirectory. Support said they were gradually rolling out a buildpack change, and I guess the checks for the old way of doing things didn't kick in for me.

    Here's where to look for the buildpack internals: https://github.com/heroku/heroku-buildpack-python/blob/master/bin/compile

提交回复
热议问题