Reputation: 21
Is Twisted good enough to use it as q production server (+wsgi) exactly like that: http://dreid.org/2009/03/twisted-django-it-wont-burn-down-your.html/ ? Is it a multithread and how to bind it to other IP than 127.0.0.1?
Thanks.
Upvotes: 2
Views: 1081
Reputation: 48335
Yes, it's multithreaded. You can verify by checking wsgi.multithread
key in the environment.
twistd web
binds to *:8080 by default, so you shouldn't need to do anything else to bind to more than 127.0.0.1.
If you want to bind to something other than *:8080, then you can use the --port
option to specify an alternate address. For example, to listen on just the 192.168.x.x interface on my desktop, I can do this:
twistd web --port tcp:interface=192.168.1.148:port=8080
This invocation will cause the server to bind only to 192.168.1.148.
If you only have one public IP address and you just want to do name-based virtual hosting, then there's twisted.web.vhost.NameVirtualHost (see the addHost
method in particular). There's no way to specify the vhost data on the command line though, you need to write a .tac file to configure this.
Upvotes: 4