已安装Wsgi,但“模块mod_wsgi不存在!”

时间:2018-07-02 08:34:52

标签: python vagrant virtualenv mod-wsgi wsgi

我想在无业游民的虚拟机上将wsgi模块(使用Flask)与apache2一起安装。

激活模块提供的错误:

09:52 ]-[vagrant@vm]-[/etc/apache2/mods-enabled]
$ python --version
Python 2.7.12

(env)
[09:56 ]-[vagrant@vm]-[/etc/apache2/mods-enabled]
$ sudo a2enmod mod-wsgi
ERROR: Module mod-wsgi does not exist!

(env)
[09:57 ]-[vagrant@vm]-[/etc/apache2/mods-enabled]
$ sudo a2enmod mod_wsgi
ERROR: Module mod_wsgi does not exist!
(env)

因此,我检查了安装:

[09:55 ]-[vagrant@vm]-[/etc/apache2/mods-enabled]
$ dpkg -l libapache2-mod-wsgi
Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/besoin Réinstallation (État,Err: majuscule=mauvais)
||/ Nom                                          Version                     Architecture                Description
+++-============================================-===========================-===========================-=============================================================================================
ii  libapache2-mod-wsgi                          4.5.2-1+deb.sury.org~xenial amd64                       Python WSGI adapter module for Apache

我要(重新)安装它:

[09:57 ]-[vagrant@vm]-[/etc/apache2/mods-enabled]
$ (sudo) pip install mod_wsgi
The directory '/home/vagrant/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/vagrant/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting mod_wsgi
  Downloading https://files.pythonhosted.org/packages/9e/37/dd336068ece37c43957aa337f25c59a9a6afa98086e5507908a2d21ab807/mod_wsgi-4.6.4.tar.gz (2.6MB)
    100% |████████████████████████████████| 2.6MB 1.5MB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-g9YSf2/mod-wsgi/setup.py", line 168, in <module>
        'missing Apache httpd server packages.' % APXS)
    RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-g9YSf2/mod-wsgi/

什么是“ apxs” ?,它是wsgi的http伴侣吗?

apache的actives模块列表在这里:

$ sudo apachectl -M
Loaded Modules:
 ...
 wsgi_module (shared)    <-----------
 ...

那么很好

模块在正确的位置:

[10:36 ]-[vagrant@vm]-[/etc/apache2/mods-enabled]
$ cat /etc/apache2/mods-available/wsgi.load
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
(env)
[10:38 ]-[vagrant@vm]-[/etc/apache2/mods-enabled]
$ ll /usr/lib/apache2/modules/mod_wsgi.so
-rwxrwxrwx 1 root root 223K mai    3  2016 /usr/lib/apache2/modules/mod_wsgi.so*

我阅读了一些教程,我认为:),我做对了:)

非常感谢。

面料

0 个答案:

没有答案