在apache和mod_wsgi中的django中使用scipy [英] using scipy in django with apache and mod_wsgi
问题描述
我已经定义了使用scipy.optimize.curve_fit
的django视图.使用django开发服务器可以正常工作,但是当我使用Apache和mod_wsgi部署Django应用程序时,导入curve_fit时,视图函数卡住了:
I have defined a django view that uses scipy.optimize.curve_fit
. This works without problems using the django development server, but when I deploy the Django application with Apache and mod_wsgi the view function gets stuck importing curve_fit:
from scipy.optimize import curve_fit
删除此行后,该应用程序的其余部分将在Apache服务器上正常运行.为什么此行不适用于Apache和mod_wsgi?
When this line is removed the rest of the app works well on the Apache server. Why does this line not work with Apache and mod_wsgi?
推荐答案
在WSGI文件中,您将看到类似以下内容的文件:
In your WSGI file you will have something that looks like this:
<VirtualHost>
...
WSGIScriptAlias / /somepath/deployment/wsgi/yoursite.wsgi
</VirtualHost>
您需要添加以下行:
<VirtualHost>
...
WSGIScriptAlias / /somepath/deployment/wsgi/yoursite.wsgi
WSGIApplicationGroup %{GLOBAL}
</VirtualHost>
对此的解释可以在这里找到:
The explanation for that can be found here:
http://mail.scipy.org/pipermail/scipy-user/2011 -November/031014.html
这篇关于在apache和mod_wsgi中的django中使用scipy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!