On Thu, Sep 4, 2008 at 1:20 PM, Mardy <[EMAIL PROTECTED]> wrote:
>
> Hi all!
>  I'm quite new to pylons, so please bear with me if the question is
> not in the correct terms. :-) I've written an application with pylons,
> and I can run it as a standalone web-server with the paster command.
> Bus as I need to access this application very very rarely (let's say
> once in a month or two), I don't want to have a service running all
> the time; instead, I would like it to be loaded by the inetd daemon.
> How should a paster config file look like, in order to achieve this?
> Basically, the service should use stdin and stdout as its input/output
> streams, instead of opening tcp ports.
> I googled for pylons+inetd, but couldn't find anything useful.
> Any hints?

Pylons is a WSGI application, so it takes a data structure (environ
dict) and returns a data structure (status string, headers list, and
body iteration of strings).  You need a WSGI server that converts
these to stdin/stdout, and I don't know if one exists, though it's
certainly part of the underlying code inside HTTP servers.  So you may
be able to find a part of an HTTP server that does this, or you may be
able to write it yourself using Python's wsgiref and HTTP modules.  If
you want to use Paste with production.ini, you'd have to define an
entry point for your server, but if you don't mind doing without
those, you can have a top-level script that simply loads the
application and runs it with your server.

But I think you might be disappointed with Pylons over inetd.  It
takes Pylons a few seconds to start up (anywhere from 2 to 10
depending on the speed of your computer).  I don't think inetd can
keep a server running for a while to handle multiple requests, so it
would be starting the server from scratch for each request, including
static files.  That may be acceptable for a utility program run by one
person once a month, but you may find it a lot of work for nothing.

If you know which days it will be used, you can set it to run as a
daemon but keep it stopped, and then have a cron job that starts it
only on the days it will be used, and then stops it.  Supervisor is a
good daemon manager.

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to