views:

24

answers:

1

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.

+1  A: 

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

Graham Dumpleton
Thanks Graham, putting the `WSGIApplicationGroup %{GLOBAL}` line into the Apache config fixed the problem with loading the CoreData libs ... now onto dealing with other Django permissions errors before I see a page without a stack trace ... :)
glenc