简体   繁体   中英

ImportError: No module named 'flask' python3 ubuntu 16.04

< mod_wsgi cannot import flask. 

I did not install flask under a virtualenv . I can import flask using a python shell just fine. I edited my virtualhost config to contain WSGIDaemonProcess HRApp user=USER group=GROUP python-path=/home/USER/.local/bin/python3.5/site-packages to no avail. What am I missing?

Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import flask
>>> flask.__version__
'1.0.2'
>>>

apache config:

    WSGIDaemonProcess HRApp user=USER group=GROUP python-path=/home/USER/.local/bin/python3.5/site-packages
    WSGIScriptAlias / /path/to/file.wsgi

    <Directory /var/www/appname>
            WSGIApplicationGroup %{GLOBAL}
            Order deny,allow
            Allow from all
            AuthType Basic
            AuthName "USER"
            AuthUserFile "/passwords_file"
            Require valid-user
    </Directory>

通过在Flask应用程序的根文件夹中安装virtualenv,然后使用WSGIPythonHome将mod_wsgi指向python安装, WSGIPythonHome

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM