【发布时间】:2014-11-25 20:27:35
【问题描述】:
期望的行为
我希望 Apache 使用安装在 virtualenv 中的 mod_wsgi,而不是依赖安装在系统级别的 mod_wsgi。我假设这是可能的,因为这就是我认为virtualenv 的用途,即创建孤立的环境。
当前行为
环境:Linux Mint 17
sudo /etc/init.d/apache2 start
AH00526: Syntax error on line 1 of /etc/apache2/sites-enabled/000-default.conf:
Invalid command 'WSGIPythonHome', perhaps misspelled or defined by a module not included
in the server configuration
Action 'configtest' failed.
/etc/apache2/sites-enabled/000-default.conf
WSGIPythonHome /var/www/html/ENV
WSGIPythonPath /var/www/html:/var/www/html/ENV/lib/python2.7/site-packages
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
WSGIScriptAlias / /var/www/html/myapp/app.wsgi
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
我的尝试
如果我通过 Synaptic 包管理器在系统级别安装 mod_wsgi,那么一切都会按预期工作。
如果我在系统级别通过 Synaptic 包管理器 *卸载* mod_wsgi,并仅依赖通过 pip 在 virtualenv 中安装的 mod_wsgi,那么我会收到上述错误。
我一直在提到这个,但无法从中收集到任何针对此问题的特定解决方案:
【问题讨论】:
标签: python-2.7 virtualenv mod-wsgi