在 Apache 中使用 mod_wsgi 时无法导入 PyObjC CoreData 模块
刚刚将一个 Web 应用程序从 TurboGears 移植到 Django,并完成了让正确的服务器运行的过程(即不是 runserver
)。尝试采用 Django 文档讨论的推荐的 Apache + mod_wsgi 路线,但由于某种原因,当您尝试在 Apache 模块中的任何位置导入 CoreData 时,线程就会停止运行,并且没有错误消息或任何其他内容。正在加载。
具体来说,它停止的点位于 CoreData/__init__.py 文件中:
__bundle__ = _objc.initFrameworkWrapper("CoreData",
frameworkIdentifier="com.apple.CoreData",
frameworkPath=_objc.pathForFramework(
"/System/Library/Frameworks/CoreData.framework"),
globals=globals())
不确定 CoreData 的什么原因导致此失败,因为 import Foundation
有效很好(即似乎并不是所有 PyObjC 的东西在 Apache 下都被破坏了,只有 CoreData 被破坏了)。
我现在正在考虑采用 lighttpd 路线,但如果有人能够阐明如何使 mod_wsgi 方式工作,那就太好了,因为我更愿意尽可能坚持建议的最简单的部署方法。
预先感谢您的任何见解。
另外:我使用的是 OSX 10.6.4 以及最新版本的 PyObjC 和 PyObjC 。 Apache 附带了这个,加上我从 Google Code 网站上获取的最新 mod_wsgi。
Just ported a webapp from TurboGears to Django and going through the process of getting a proper server running (i.e. not runserver
). Tried going the recommended Apache + mod_wsgi route that the Django docs talk about, but for some reason the thread stalls out with no error message or anything as soon as you try to import CoreData
anywhere in a module that Apache is loading.
Specifically, the point at which it stalls out is in the CoreData/__init__.py
file here:
__bundle__ = _objc.initFrameworkWrapper("CoreData",
frameworkIdentifier="com.apple.CoreData",
frameworkPath=_objc.pathForFramework(
"/System/Library/Frameworks/CoreData.framework"),
globals=globals())
Not sure what it is about CoreData that makes this fail, since import Foundation
works fine (i.e. it doesn't seem to be that all the PyObjC stuff is broken under Apache, just CoreData).
I'm kinda looking into going the lighttpd route now instead, but if anyone could shed light on how to make the mod_wsgi way work that would be good, as I would prefer to stick as close to the suggested simplest deployment method as possible.
Thanks in advance for any insights.
Also: I'm on OSX 10.6.4 with whatever latest version of PyObjC & Apache comes with that, plus the latest mod_wsgi I grabbed from the Google Code website.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试强制 WSGI 应用程序在主解释器中运行。听起来 PyObjC 没有正确实现,无法在子解释器中使用。请参阅:
http://code.google.com/p/modwsgi/wiki/应用程序问题#Python_Simplified_GIL_State_API
Try forcing WSGI application to run in main interpreter. Sounds like PyObjC is not implemented correctly so as to be used in sub interpreters. See:
http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_State_API