[Twisted-Python] using http server in twisted
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/
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:
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 ?
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
From: mark Reply-To: Twisted general discussion
To: Twisted general discussion Subject: Re: [Twisted-Python] using http server in twisted Date: Mon, 30 May 2005 12:45:47 +0100 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:
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 ?
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
_________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
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
Hello, I was wrong; it should have been render_GET and not render_get . Sorry. John
From: mark Reply-To: Twisted general discussion
To: Twisted general discussion Subject: Re: [Twisted-Python] using http server in twisted Date: Mon, 30 May 2005 18:41:25 +0100 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
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
_________________________________________________________________ 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