uwsgi + Flask + virtualenv ImportError: no module named site

前端 未结 8 685
感动是毒
感动是毒 2021-02-05 07:37

(Other posts on SO are similar, but none have the specific combination of uwsgi + Flask + virtualenv) (This one is closest)

I installed uwsgi via apt-get. I also tried

8条回答
  •  余生分开走
    2021-02-05 07:55

    The path to your virtual environment is wrong. That's the reason for this error.

    I'm using virtualenvwrapper and my virtual environments are set at ~/.virtualenvs. So in my case, the uwsgi call would look something like

    sudo uwsgi -s /tmp/uwsgi.sock -w myapp:app -H ~/.virtualenvs/myapp
    

    Hope this helps next time someone comes looking for this one.

    Thanks to Cody for pointing it out in the comments.

提交回复
热议问题