为wsgi提供正确的python包路径名

时间:2019-04-19 07:13:19

标签: python apache flask

我已经在系统上安装了必需的软件包,但是python以某种其他方式查看了该软件包。

之前使用的是python2。所以我安装了sudo apt-get install libapache2-mod-wsgi-py3

现在Apache正在使用python3。我已经在虚拟环境中使用pip3安装了flask,但是在运行时却找不到任何烧瓶。

我已经检查了其他文章,并尝试提供conf文件的路径。

WSGIDaemonProcess /app3 python-path=/var/www/html/textsummarization:/var/www/html/venv3.6/lib/python3.6/site-packages
WSGIScriptAlias /app3 /var/www/html/textsummarization/app.wsgi
<Directory /var/www/html/textsummarization/>
        Order allow,deny
        Allow from all
</Directory>

这里是/var/www/html/textsummarization是我的项目文件夹,其后是已安装flask的Python3网站包位置。

此处已对此进行了解释-https://www.digitalocean.com/community/tutorials/how-to-run-django-with-mod_wsgi-and-apache-with-a-virtualenv-python-environment-on-a-debian-vps

错误是:

[Fri Apr 19 07:08:01.086441 2019] [wsgi:error] [pid 27072:tid 140155700328192] [client 182.73.252.54:49921] mod_wsgi (pid=27072): Target WSGI script '/var/www/html/textsummarization/app.wsgi' cannot be loaded as Python module.
[Fri Apr 19 07:08:01.086511 2019] [wsgi:error] [pid 27072:tid 140155700328192] [client 182.73.252.54:49921] mod_wsgi (pid=27072): Exception occurred processing WSGI script '/var/www/html/textsummarization/app.wsgi'.
[Fri Apr 19 07:08:01.086854 2019] [wsgi:error] [pid 27072:tid 140155700328192] [client 182.73.252.54:49921] Traceback (most recent call last):
[Fri Apr 19 07:08:01.086881 2019] [wsgi:error] [pid 27072:tid 140155700328192] [client 182.73.252.54:49921]   File "/var/www/html/textsummarization/app.wsgi", line 6, in <module>
[Fri Apr 19 07:08:01.086885 2019] [wsgi:error] [pid 27072:tid 140155700328192] [client 182.73.252.54:49921]     from app import app as application
[Fri Apr 19 07:08:01.086901 2019] [wsgi:error] [pid 27072:tid 140155700328192] [client 182.73.252.54:49921]   File "/var/www/html/textsummarization/app.py", line 2, in <module>
[Fri Apr 19 07:08:01.086905 2019] [wsgi:error] [pid 27072:tid 140155700328192] [client 182.73.252.54:49921]     from flask import Flask, render_template, request, jsonify,flash,redirect,url_for
[Fri Apr 19 07:08:01.086919 2019] [wsgi:error] [pid 27072:tid 140155700328192] [client 182.73.252.54:49921] ModuleNotFoundError: No module named 'flask'

0 个答案:

没有答案