我该如何解决这个问题?
mod_wsgi (pid=3445): Target WSGI script '/www/folder/index.py' cannot be loaded as Python module
[root@ip-172-31-8-1 www]# tail /var/log/httpd/error_log
[Thu Jan 11 07:57:19 2018] [error] [client 175.209.112.71] from flask import Flask
[Thu Jan 11 07:57:19 2018] [error] [client 175.209.112.71] ImportError: No module named flask
[Thu Jan 11 07:57:20 2018] [error] [client 175.209.112.71] mod_wsgi (pid=3445): Target WSGI script '/www/folder/index.py' cannot be loaded as Python module., referer: http://URL
[Thu Jan 11 07:57:20 2018] [error] [client 175.209.112.71] mod_wsgi (pid=3445): Exception occurred processing WSGI script '/www/folder/index.py'., referer: http://URL
[Thu Jan 11 07:57:20 2018] [error] [client 175.209.112.71] Traceback (most recent call last):, referer: http://URL
[Thu Jan 11 07:57:20 2018] [error] [client 175.209.112.71] File "/www/folder/index.py", line 5, in <module>, referer: http://URL
[Thu Jan 11 07:57:20 2018] [error] [client 175.209.112.71] from apps import app, referer: http://URL
[Thu Jan 11 07:57:20 2018] [error] [client 175.209.112.71] File "/www/folder/apps/__init__.py", line 3, in <module>, referer: http://URL
[Thu Jan 11 07:57:20 2018] [error] [client 175.209.112.71] from flask import Flask, referer: http://URL
[Thu Jan 11 07:57:20 2018] [error] [client 175.209.112.71] ImportError: No module named flask, referer: http://URL
答案 0 :(得分:0)
您可以通过解决日志文件中报告的错误来解决此问题。我建议首先确保WSGI正在使用的python是正确的,并且它具有代码期望安装的所有第三方模块(提示:烧瓶)
答案 1 :(得分:0)
您的mod_wsgi已针对不同版本的Python进行了编译,或者您尚未将mod_wsgi配置为使用已安装Flask的Python虚拟环境。
有关设置虚拟环境的信息,请参阅:
要检查编译的mod_wsgi版本和使用,请参阅: