pgAdmin4安装-目标WSGI脚本无法作为Python模块加载

时间:2018-12-08 04:58:55

标签: python apache2 ubuntu-16.04 mod-wsgi

here之前已经问过这个问题,但是该解决方案对我不起作用。我的python venv配置无法与apache2 mod_wsgi配合使用,并且我无法引起该问题。目前,我无法对此问题发表评论,因此我要发布另一个问题

这是尝试登录站点时的apache2错误日志。

[Fri Dec 07 20:32:25.476491 2018] [wsgi:warn] [pid 25982:tid 140573456193408] mod_wsgi: Compiled for Python/3.5.1+.
[Fri Dec 07 20:32:25.476529 2018] [wsgi:warn] [pid 25982:tid 140573456193408] mod_wsgi: Runtime using Python/3.5.2.
[Fri Dec 07 20:32:25.477326 2018] [mpm_event:notice] [pid 25982:tid 140573456193408] AH00489: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/3.5.2 configured -- resuming normal operations
[Fri Dec 07 20:32:25.477362 2018] [core:notice] [pid 25982:tid 140573456193408] AH00094: Command line: '/usr/sbin/apache2'
[Fri Dec 07 20:34:24.401510 2018] [wsgi:error] [pid 25983:tid 140573343934208] [remote 10.2.5.243:15047] mod_wsgi (pid=25983): Target WSGI script '/home/awashburn/anaconda3/envs/pgadmin4/lib/python3.7/site-packages/pgadmin4/pgAdmin4.wsgi' cannot be loaded as Python module.
[Fri Dec 07 20:34:24.401642 2018] [wsgi:error] [pid 25983:tid 140573343934208] [remote 10.2.5.243:15047] mod_wsgi (pid=25983): Exception occurred processing WSGI script '/home/awashburn/anaconda3/envs/pgadmin4/lib/python3.7/site-packages/pgadmin4/pgAdmin4.wsgi'.
[Fri Dec 07 20:34:24.402195 2018] [wsgi:error] [pid 25983:tid 140573343934208] [remote 10.2.5.243:15047] Traceback (most recent call last):
[Fri Dec 07 20:34:24.402229 2018] [wsgi:error] [pid 25983:tid 140573343934208] [remote 10.2.5.243:15047]   File "/home/awashburn/anaconda3/envs/pgadmin4/lib/python3.7/site-packages/pgadmin4/pgAdmin4.wsgi", line 25, in <module>
[Fri Dec 07 20:34:24.402236 2018] [wsgi:error] [pid 25983:tid 140573343934208] [remote 10.2.5.243:15047]     import config
[Fri Dec 07 20:34:24.402244 2018] [wsgi:error] [pid 25983:tid 140573343934208] [remote 10.2.5.243:15047]   File "/home/awashburn/anaconda3/envs/pgadmin4/lib/python3.7/site-packages/pgadmin4/config.py", line 29, in <module>
[Fri Dec 07 20:34:24.402248 2018] [wsgi:error] [pid 25983:tid 140573343934208] [remote 10.2.5.243:15047]     from pgadmin.utils import env, IS_PY2, IS_WIN, fs_short_path
[Fri Dec 07 20:34:24.402256 2018] [wsgi:error] [pid 25983:tid 140573343934208] [remote 10.2.5.243:15047]   File "/home/awashburn/anaconda3/envs/pgadmin4/lib/python3.7/site-packages/pgadmin4/pgadmin/__init__.py", line 18, in <module>
[Fri Dec 07 20:34:24.402260 2018] [wsgi:error] [pid 25983:tid 140573343934208] [remote 10.2.5.243:15047]     from flask import Flask, abort, request, current_app, session, url_for
[Fri Dec 07 20:34:24.402280 2018] [wsgi:error] [pid 25983:tid 140573343934208] [remote 10.2.5.243:15047] ImportError: No module named 'flask'

这是Vhost配置:

<VirtualHost *>
    ServerName shinyapp01t

    WSGIDaemonProcess pgadmin processes=1 threads=25 python-home=/home/awashburn/anaconda3/envs/pgadmin4 display-name=pgadmin4
    WSGIScriptAlias /pgadmin /home/awashburn/anaconda3/envs/pgadmin4/lib/python3.7/site-packages/pgadmin4/pgAdmin4.wsgi

    <Directory "/home/awashburn/anaconda3/envs/pgadmin4/lib/python3.7/site-packages/pgadmin4/">
        WSGIProcessGroup pgadmin
        WSGIApplicationGroup %{GLOBAL}
        Require all granted
    </Directory>
</VirtualHost>

我引用了these instructions from DigitalOcean,试图在Ubuntu 16.04上安装pgAdmin4。

编辑:我使用python3 venv代替anaconda虚拟env,并且一切正常。因此,根本原因是anaconda系统。 There's a discussion on the mod_wsgi mailing list about this

0 个答案:

没有答案