[IronPython] IronPython/NWSGI 0-byte 200/404 response with HelloWorld?
mjt at nysv.org
Sat Sep 26 00:05:52 PDT 2009
On Fri, Sep 25, 2009 at 02:13:14PM -0600, Jeff Hardy wrote:
>On Fri, Sep 25, 2009 at 1:01 PM, Markus Törnqvist <mjt at nysv.org> wrote:
>> I haven't debugged this too much, yet, but I'm not sure what to make of it.
>> I certainly never had a settings.SESSION_ENGINE, and when I run CPython
>> and manage.py runserver elsewhere with tracing in the sources, I see it
>> default to django.contrib.sessions.backends.db
>You can add SESSION_ENGINE to your config file to change which backend
>it uses. It's in the django docs, somewhere.
Yeah I figured that part out ;) What I didn't figure out how it sets
the db backend instead of raising an AttributeError...
>> I probably need to sleep on this, I'm not getting where the magic
>> is happening, but in any case, it might also be that IronPython still
>> has import problems, because I've run this with CPython successfully...
>IIRC, the default session db backend doesn't work with IronPython. For
>testing I usually used the cache backend, and then set the cache to
>use the in-memory backend. Again, this is in the django docs,
Do you have any pointers on why?
The only way I figured to debug is raise ValueError('|%s|' % engine)
and it tells me
|<module 'django.contrib.sessions.backends.db' from 'C:\Program Files\IronPython 2.6\Lib\site-packages\django\contrib\sessions\backends\db.py'>|
So I changed it to raise ValueError('|%s|' % dir(engine))
to see what's in there, because the db backend certainly has a SessionStore.
Instead of anything expected, I got
'module' object has no attribute 'fix_location_header'
Line 170: return '\n'.join(traceback.format_exception(*(exc_info or
Line 172: def apply_response_fixes(self, request, response):
Line 173: """
Line 174: Applies each of the functions in self.response_fixes to the request and
Source File: C:\Program Files\IronPython 2.6\Lib\site-packages\django\core\handlers\base.py Line: 172
What happens there is, it iterates over self.response_fixes, and its first
element is http.fix_location_header. There's "from django import http"
http\__init__.py says "from utils import *" and http\utils.py has
def fix_location_header(request, response)
How do we debug this further? Looks like nearly random import breakage
to me still :/
>> I also found this django-aspnet thing, but its session store is apparently
>> just another backend, not anything that would fix this issue :/
>It uses the ASP.NET session store as a backend
>which might actually take care of your issue. I haven't updated them
>in a while, so I'm not sure if they work with the latest version of
I had to hack a bit to get MSSQL going and for all these other issues
I haven't gotten around to really proofing it :P
I have the base/dbapi/query files in a package directory, with a sub-package
adonet2dbapi, and at least then it didn't break.
I also had to replace dbapi.py, because the original one was using
pythoncom and win32com.client, which are not for ironpython, and I figured
it cleaner to use something else than port the com interface stuff...
I'll give the ASP.NET solution a try, at some point, but we must first
understand why these imports don't work :/
More information about the Users