问题描述
我正在尝试在 apache mod-wsgi 上部署用于生产的 django 应用程序.我有一个名为 freecad 的第三方 python 应用程序,它将 python 模块打包在 FreeCAD.so 库文件中.请求挂在导入 FreeCAD"上.一些 apache 日志错误告诉我这可能是 zlib 的问题??尝试导入此模块时压缩.请注意,使用 django 的 runserver 时一切正常.
I'm trying to deploy a django application for production on apache mod-wsgi. I have a third party python application called freecad which packages python module in an FreeCAD.so library file. Requests hang on 'import FreeCAD'. Some apache log errors tell me that it might be problem with zlib?? compression when trying to import this module.Note that everything works just fine when using django's runserver.
仔细研究之后,这不是压缩问题,也不是权限问题.我使用
After looking more into this, it's not a compression issue,neither is a permission.I did as www-data user using
$ sudo -u www-data python
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/usr/lib/freecad/lib')
>>> import FreeCAD
FreeCAD 0.10, Libs: 0.10R3225
>>>
但它仍然挂在从网页请求中导入 FreeCAD"
but it still hangs on 'import FreeCAD' from web page request
推荐答案
设置:
WSGIApplicationGroup %{GLOBAL}
请参阅 mod_wsgi wiki 上的应用程序问题文档.
See the application issues document on mod_wsgi wiki.
很可能你有一个扩展模块不是为在子解释器中工作而设计的.以上强制它在主解释器中运行.
Most likely you have an extension module not designed to work in sub interpreter. The above forces it to run in main interpreter.
这篇关于django apache mod-wsgi 在从 .so 文件导入 python 模块时挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!