django apache mod-wsgi挂起从.so文件导入一个python模块 [英] django apache mod-wsgi hangs on importing a python module from .so file

查看:114
本文介绍了django apache mod-wsgi挂起从.so文件导入一个python模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在apache mod-wsgi上部署一个用于生产的django应用程序。我有一个名为freecad的第三方python应用程序,它在FreeCAD.so库文件中包装python模块。请求挂在'导入FreeCAD'上。一些apache日志错误告诉我,这可能是zlib的问题?尝试导入此模块时的压缩。
请注意,使用django的runserver时,所有内容都可以正常工作。



查看更多内容后,这不是一个压缩问题,也不是一个权限。
我做了www数据用户使用

  $ sudo -u www-data python 
Python 2.6 linux2
上的
[GCC 4.4.5]类型帮助,版权,信用或许可证为.6(r266:84292,2010年9月15日,16:22:56)更多信息。
>>>导入sys
>>>> sys.path.append('/ usr / lib / freecad / lib')
>>>导入FreeCAD
FreeCAD 0.10,Libs:0.10R3225
>>>

但它仍然挂起从网页请求导入FreeCAD

解决方案

设置:

  WSGIApplicationGroup%{GLOBAL} 

请参阅mod_wsgi wiki上的应用程序问题文档。



很可能你有一个扩展模块不是设计用于子解释器。以上强制它在主要口译员中运行。


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
>>> 

but it still hangs on 'import FreeCAD' from web page request

解决方案

Set:

WSGIApplicationGroup %{GLOBAL}

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模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆