[Twisted-Python] spawn wsgi resource into separate process

In the following code I am attempting to host several django applications in vhosts - http://pastie.org/1122806 . This code works fine if I only need one settings module. In my case each vhost needs it's own(lines 32-38) DJANGO_SETTINGS_MODULE environment variable. It appears that I need to use reactor.spawnProcess to spawn a new process with the required environment variable. Can anyone give me a few suggestions as to how to accomplish this task? I think that it involves writing a custom protocol that would communicate with the wsgi process but there may be better options available. Any suggestions would be greatly appreciated.

On Sat, Aug 28, 2010 at 9:37 PM, Thomas Johnson <tomfmason@gmail.com> wrote:
In the following code I am attempting to host several django applications in vhosts - http://pastie.org/1122806 . This code works fine if I only need one settings module. In my case each vhost needs it's own(lines 32-38) DJANGO_SETTINGS_MODULE environment variable. It appears that I need to use reactor.spawnProcess to spawn a new process with the required environment variable.
I have run into a similar problem before. But did you know that any dict to be treated as the environment can be passed as the first argument to WSGIHandler()? That's exactly what helped me. -- Engineer : How do I do it? Economist : How much will it cost? Twisted Developer: But does it block?

I have run into a similar problem before. But did you know that any dict to be treated as the environment can be passed as the first argument to WSGIHandler()? That's exactly what helped me.
I have tried several different methods and game up with mixed results. I have tried overriding the __call__ method in the WSGIHandler and it appears to have the same results(same settings file being used). How where you able to accomplish this task?
participants (2)
-
Thomas Johnson
-
Yaroslav Fedevych