[Twisted-Python] using http server in twisted

John Que qwejohn at hotmail.com
Mon May 30 05:28:47 MDT 2005


Hello,

I am trying the exmaple in the python docs -
http://twistedmatrix.com/users/warner/doc-latest/web/howto/using-twistedweb.xhtml

Configuring and Using the Twisted.Web Server - Twisted Web Development.

it says there:

"You can also create a Site instance by hand, passing it a Resource object 
which will serve as the root of the site:

from twisted.web import server, resource
from twisted.internet import reactor

class Simple(resource.Resource):
    isLeaf = True
    def render_GET(self, request):
        return "<html>Hello, world!</html>"

site = server.Site(Simple())
reactor.listenTCP(8080, site)
reactor.run()   "

So I prepared a script named myhttp exactly like this and ran ./myhttp

I had made sure with netstat that indeed port 8080 was free before running 
the script and after
running the script it was in a listening state.

But when pointing the Mozilla browser to http://localhost:8080 (or  
http://127.0.0.1:8080)
I got the following error:

"Method Not Allowed
Your browser approached me (at /) with the method "GET". I only allow the 
method here."

I had also made sure that there in no problem with iptables and that the 
iptable service is down.

Any idea ?

Am I missing something?

Any help will be appreciated.

Regards,
John

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/





More information about the Twisted-Python mailing list