Actually I have two similar questions. Depending on which one is
possible I plan to proceed with my project...
I have written a network application framework which is not related
with WSGI. It is a telephony application framework which communicates
with different servers and in other occasions is server for other
clients. This is all non HTTP related. I'm using pase script to create
templates for applications using this framework. One such application
would for example implement IVR system (using this framework). I'm
starting such applications with paster, but not with "serve" command -
I start it with my custom "run" command.
1. Is it possible to serve such generic network application with
"paster serve" instead of my custom "paster run". I would like to
reuse reload/deamonize... ability of "serve" (and possibly be ready
for point 2; read on)?
paster serve creates a "wsgi application" and a "wsgi server" and then starts the server with the app like:
server(app)
(All the configuration has already been passed in at this point)
So while these servers and apps are usually WSGI, there's nothing in paster serve that actually cares one way or the other. So you could create your own server and app that communicate in their own way, and present them as configurable servers and apps.
Next, I have to add HTTP functionality to this framework (restful web
services). The *framework* itself would use HTTP to expose framework
services, while applications programmed using this framework would
*not* directly use HTTP (at first). The wsgi server code for web
services is contained inside the framework.
Usually I use pylons/tg2 for my web projects. They are normally
started with paster serve. I would like to use one of them.
2. If I choose to use "paster wsgi aware" web framework like pylons,
how would I configure my application so that this hidden wsgi
application is started together with my application.
Well, this is a bit more tricky, as there isn't anything natively in the system to do this. But if you are already making a custom server, you could make one that starts your telephony server, and also starts another server, writing the startup in Python. You'll probably need threads to run them both.
So you might do:
[server:main]
use = egg:MyProject#server
telephony_port = 1234
http_port = 8080
and so on, just putting all the settings together under one "server".
--
Ian Bicking |
http://blog.ianbicking.org |
http://topplabs.org/civichacker