<br><br><div><span class="gmail_quote">On 2/8/06, <b class="gmail_sendername">Todd Thomas</b> &lt;<a href="mailto:caliban19@gmail.com">caliban19@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><span class="e" id="q_1094b9b45d0220c8_0"><br><br><div><span class="gmail_quote">On 2/8/06, <b class="gmail_sendername">David Reid</b> &lt;<a href="mailto:dreid@dreid.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
dreid@dreid.org</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Todd Thomas wrote:<br>&gt; It does support wsgi, I was playing around with it. I went back to<br>&gt; twisted-web, I like its lower level approach. Using http.request<br>&gt; directly vs. resources is nice since I can pretty much tell exactly what
<br>&gt; is going on. I love the fact that you can work at an extremely low level<br>&gt; in twisted-web. I hope twisted-web2 doesn't get too high level.<br><br>I don't really understand this, twisted.web _has_ resources.&nbsp;&nbsp;They're
<br>not very good in that one resource is expected to return another<br>resource to consume the next segment in the path, which makes it hard to<br>stop the machinery.&nbsp;&nbsp;But if you mean what I think you mean (which I hope
<br>
you don't) and that you're working with your own server.Site then I'd<br>say you need twisted.web2 more than anyone, because it's resource api<br>will allow you to make your framework work along side others.&nbsp;&nbsp;Which is<br>

one of the problems with current Nevow and part of the reason<br>twisted.web2 was started.<br><br>-David<br><br><br>_______________________________________________<br>Twisted-web mailing list<br><a href="mailto:Twisted-web@twistedmatrix.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

Twisted-web@twistedmatrix.com</a><br><a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
</a><br></blockquote></div></span></div>You
just described exactly the problem I am currently having with
twisted-web2. I tried to create wsgi as a root resource, however its
also dependent on static files in media directory. I wasn't able to
create a child object due to no matter what it passes full path to the
wsgi application. So then I made it a child of a root resource, this
sort of worked. But since the root path was consumed when it is passed
to the child resource, when the application does a redirect, it creates
the url in relation to root, not the child url. In my own application I
could work around this without too much difficulty since I already know
where my child is in relation to the root object.<br>

</blockquote></div>Okay, I seemed to have solved most of my problems.
Only issue having now is pysqlite2 doesn't like being called from
threads seperate from the ones that created it. It could be run as a
deferred in this case since it does respond pretty quick. But I am sure
could solve this issue simply by changing to mysql or postgresql. The
solution was stupidly simple.<br>
<br>
from twisted.application import strports, service<br>
from twisted.web2 import static, server, http, wsgi, resource<br>
<br>
import sys<br>
sys.path.append(&quot;./myproject&quot;)<br>
from django.core.handlers.wsgi import WSGIHandler<br>
import os<br>
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'<br>
<br>
class toplevel(wsgi.WSGIResource):<br>
<br>
<br>
&nbsp;&nbsp;&nbsp; def child_media(self, ctx):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return static.File(&quot;./myproject/media&quot;)<br>
<br>
<br>
root = toplevel(WSGIHandler())<br>
application = service.Application(&quot;web&quot;)<br>
site = server.Site(root)<br>
s = strports.service('tcp:8000', http.HTTPFactory(site))<br>
s.setServiceParent(application)<br>
<br>
<br>
It works fairly well, or would if I wasn't testing on windows. Before
you ask why windows. I have box I dual boot into and normally run
secure shell to, using ubuntu linux currently. Unfortunately my
computer has sims 2 on which my g/f has been playing religiously
lately. So I am stuck using windows at work for right now. <br>
<br>
ToddB<br>