Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
877 views
in Technique[技术] by (71.8m points)

django apache mod-wsgi hangs on importing a python module from .so file

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...