django and simulating WSGI daemons

2 views
Skip to first unread message

KpoH

unread,
Jul 29, 2008, 2:25:50 PM7/29/08
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.

Ionel Maries Cristian

unread,
Jul 29, 2008, 2:45:57 PM7/29/08
to co...@googlegroups.com
It should work, both with regular wsgi apps and wrapper django apps in the wsgi handler.

If anything is going wrong is probably django's or your app/conf's fault.
Could you provide some sample django apps and configurations
reproducing your problem ?
--
ionel maries cristian

slav0nic

unread,
Jul 30, 2008, 8:58:48 AM7/30/08
to cogen
yes, this is django problem
Reply all
Reply to author
Forward
0 new messages