Flask - WSGI - No module named 'flask'

后端 未结 6 843
闹比i
闹比i 2021-02-01 23:50

I\'ve been following Sentdex\' Flask tutorial. He\'s using a Venv to set up his Flask, but didn\'t set his Python up to work with a Venv. I\'ve tried installing Flask globally -

6条回答
  •  遇见更好的自我
    2021-02-02 00:43

    As is polite behaviour when finding the solution, I googled around a bit more, and somehow managed to find a solution from a YouTube commment by Nathan Nichols here:

    https://www.digitalocean.com/community/tutorials/how-to-run-django-with-mod_wsgi-and-apache-with-a-virtualenv-python-environment-on-a-debian-vps

    1. Edit /etc/apache2/sites-available/FlaskApp.conf
    2. Add the following two lines before the "WSGIScriptAlias" line:

      WSGIDaemonProcess FlaskApp python-path=/var/www/FlaskApp:/var/www/FlaskApp/FlaskApp/venv/lib/python2.7/site-packages
      WSGIProcessGroup FlaskApp
      
    3. Restart Apache with "service apache2 restart"

    I of course replaced the Python version with python3.5, which is what I'm running.

提交回复
热议问题