KpoH
unread,Jul 29, 2008, 2:25:50 PM7/29/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to cogen
Hello,
I'm trying to run two (N in perspective) WSGI daemons
I've used slav0nic's code
import sys
import os
import os.path
from cogen.web import wsgi
from cogen.web.async import sync_input
from cogen.common import *
path = os.path.dirname(os.path.realpath(__file__))
if not path in sys.path:
sys.path.insert(0, path)
from django.core.handlers.wsgi import WSGIHandler
_application = WSGIHandler()
def application(environ, start_response):
os.environ['DJANGO_SETTINGS_MODULE'] = 'asd_settings'
return _application(environ, start_response)
def application2(environ, start_response):
os.environ['DJANGO_SETTINGS_MODULE'] = 'huis_settings'
return _application(environ, start_response)
m = Scheduler(default_priority=priority.LAST, default_timeout=15)
server = wsgi.WSGIServer(
('localhost', 9000),
sync_input(application),
m,
server_name='localhost'
)
server2 = wsgi.WSGIServer(
('localhost', 9001),
sync_input(application2),
m,
server_name='localhost2'
)
m.add(server.serve)
m.add(server2.serve)
try:
m.run()
except (KeyboardInterrupt, SystemExit):
pass
But this didn't work. It causes to serve only the first requested
daemon, and only his settings is in effect.