在让我的Django应用程序在生产中运行的过程中,我意识到apt-get mod_wsgi没有安装正确版本的mod_wsgi。建议是在我的虚拟环境中安装mod_wsgi。
我正在运行AWS Small Ubuntu 16.04.4 LTS服务器和Python 3.5。
我的虚拟环境是/ usr / local / pulseenv,包含mod-wsgi 4.6.4。
我的vhost文件(/etc/apache2/sites-available/000-default.conf)有:
df1=pd.DataFrame({'A':[1,2]},index=[0,1])
df2=pd.DataFrame({'A':[1,2]},index=[1,2])
print(pd.concat([df1,df2],axis=1))
df2=pd.DataFrame({'A':[1,2]},index=df1.index)
print(pd.concat([df1,df2],axis=1))
A A
0 1.0 NaN
1 2.0 1.0
2 NaN 2.0
A A
0 1 1
1 2 2
但是当我尝试启动apache时,我收到了这个错误:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
#DocumentRoot /var/www/html
DocumentRoot /var/www/pulsemanager/pulsemanager
Alias /static /var/www/pulsemanager/pulsemanager/static
<Directory /var/www/pulsemanager/pulsemanager/static>
Require all granted
</Directory>
<Directory /var/www/pulsemanager/config>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /var/www/pulsemanager/config/wsgi.py
#WSGIDaemonProcess pulsemanager
WSGIPythonHome /usr/local/pulseenv
WSGIPythonPath /var/www/pulsemanager
#WSGIProcessGroup pulsemanager
WSGIApplicationGroup %{GLOBAL}
</VirtualHost>
所以似乎Apache不能找到mod_wsgi。 (这是WSGI *命令的位置吗?)那么如何使用pip install mod_wsgi配置Apache?
答案 0 :(得分:0)
设置mod_wsgi的首选方法是在其自己的守护进程组中运行每个WSGI应用程序。
WSGIDaemonProcess myapp
WSGIProcessGroup myapp
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /var/www/pulsemanager/config/wsgi.py
<Directory /var/www/pulsemanager/config>
Require all granted
</Directory>
引用:https://modwsgi.readthedocs.io/en/latest/user-guides/virtual-environments.html