[Twisted-Python] using http server in twisted
![](https://secure.gravatar.com/avatar/25889c4928524995be1dfe1b90b47d66.jpg?s=120&d=mm&r=g)
Hello, I am trying the exmaple in the python docs - http://twistedmatrix.com/users/warner/doc-latest/web/howto/using-twistedweb.... 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/
![](https://secure.gravatar.com/avatar/3eaacd20213c065e92c80e78b586d687.jpg?s=120&d=mm&r=g)
Hi, I run my app in very much the same way and it works fine. A rapid cut and paste test of your example works just fine here as well. I would suggest that there is something else running on port 8080 (or blocking/fire-walling it) cheers mark On 30 May 2005, at 12:28, John Que wrote:
![](https://secure.gravatar.com/avatar/25889c4928524995be1dfe1b90b47d66.jpg?s=120&d=mm&r=g)
Hello, Thanks; this is stange; I checked again with netstat and 8080 was free before running the script and held afterwards. And the iptables service is are down. and again I get the same error . Could it be that something else in the environment is not OK? Any idea? Regards, John
_________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
![](https://secure.gravatar.com/avatar/3eaacd20213c065e92c80e78b586d687.jpg?s=120&d=mm&r=g)
A quick "spotlight" reveals that the error message is coming from the file /Twisted-1.3.0/twisted/web/server.py I'd have a read of the comments in there. I'm using Twisted 2.0.1 so it might be different. Having said that I would have thought that example should work. On 30 May 2005, at 14:04, John Que wrote:
Your browser approached me
![](https://secure.gravatar.com/avatar/25889c4928524995be1dfe1b90b47d66.jpg?s=120&d=mm&r=g)
Hello, I was wrong; it should have been render_GET and not render_get . Sorry. John
_________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
![](https://secure.gravatar.com/avatar/3eaacd20213c065e92c80e78b586d687.jpg?s=120&d=mm&r=g)
Hi, I run my app in very much the same way and it works fine. A rapid cut and paste test of your example works just fine here as well. I would suggest that there is something else running on port 8080 (or blocking/fire-walling it) cheers mark On 30 May 2005, at 12:28, John Que wrote:
![](https://secure.gravatar.com/avatar/25889c4928524995be1dfe1b90b47d66.jpg?s=120&d=mm&r=g)
Hello, Thanks; this is stange; I checked again with netstat and 8080 was free before running the script and held afterwards. And the iptables service is are down. and again I get the same error . Could it be that something else in the environment is not OK? Any idea? Regards, John
_________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
![](https://secure.gravatar.com/avatar/3eaacd20213c065e92c80e78b586d687.jpg?s=120&d=mm&r=g)
A quick "spotlight" reveals that the error message is coming from the file /Twisted-1.3.0/twisted/web/server.py I'd have a read of the comments in there. I'm using Twisted 2.0.1 so it might be different. Having said that I would have thought that example should work. On 30 May 2005, at 14:04, John Que wrote:
Your browser approached me
![](https://secure.gravatar.com/avatar/25889c4928524995be1dfe1b90b47d66.jpg?s=120&d=mm&r=g)
Hello, I was wrong; it should have been render_GET and not render_get . Sorry. John
_________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
participants (2)
-
John Que
-
mark