[Grok-dev] Re: zopectl autorestart

Martin Aspeli optilude at gmx.net
Tue Jun 10 16:30:07 EDT 2008


Fernando Correa Neto wrote:
> Hey
> 
> On Mon, Jun 9, 2008 at 8:08 PM, Martin Aspeli <optilude at gmx.net 
> <mailto:optilude at gmx.net>> wrote:
> 
>     Peter Bengtsson wrote:
> 
>         I've managed to hack zc.zope3recipes.ctl to accept another program
>         called "autorestart". You run it like this::
> 
>          $ ./bin/zopectl autorestart src/mymodule
> 
>         It will then start an inotify watcher to watch all .py files (except
>         tests) and .pt files that define a macro and whenever it spots a
>         change it restarts Zope.
> 
> 
>     Why not just use the support built into paste? If you use Paste to
>     serve a WSGI application, you can just do:
> 
>     $ paster serve --reload myprogram.ini
> 
>     This is what things like Pylons, TurboGears (I think) and Repoze are
>     doing, and you get it for free. I'm pretty sure Philipp already
>     experimented with this somewhere, even.
> 
> 
> 
> I didn't have time to check it out but do you know what "--reloads" 
> means here? Will it actually grok everything again as in a full restart 
> or will it just use the python built-in reload() on the file that was 
> changed?
> If it is reload(), I am not sure if this is going to work 100% since 
> you'd need to tell the global registries to unregister/register 
> everything again.
> 
> Anyway, I will take a look at that.

paster controls the process (i.e. your app is a WSGI app that's served 
via Paste Deploy). When it detects a change, it restarts itself. No 
reload().

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the Grok-dev mailing list