views:

393

answers:

2

When I start the `Paste' web server in daemon mode, it seems to kill off it's ability to reload when the timestamp of a source file is updated.

Here is how I start the daemon...

cd ${project} && ../bin/paster serve --reload --daemon development.ini; cd ..;

...which defeats one of the main points of using Paste (for me).

Has anyone come across this or know what I'm doing wrong?

To be complete, the file that I'm changing is a controller file.

The version is `PasteScript 1.7.3'

+2  A: 

I believe that the two options are essentially incompatible, since the reloader stops the server with a SIGTERM and the daemon-ized server is impervious to that -- and since daemon is intended for running in a production environment, and reload for a development/debugging environment, I guess that their incompatibility is not seen as a big loss. I imagine a customized reloader, tailored to properly stop and restart the daemonized server, could certainly be developed, but I don't know of any existing one.

Alex Martelli
Thankyou - that what I needed to hear. :)
Cyrus
The file monitor for --reload checks every source file every second and can use a significant amount of CPU time. You should never use that in production. If you use mod_wsgi, it can reload by checking the timestamp on just the single .wsgi script that loads your application. Other WSGI servers have significant reloading features, too, like Spawning.
joeforker
+2  A: 

I had a similar problem and circumvented the problem. I currently have paster running on a remote host, but I am still developing, so I needed a means to restart paster, but manually by hand was too time consuming, and daemon didnt work. So I always had to keep a shell window open to the server and running paster without --daemon in there. Once I finished my work for that day, and i closed the shell, paster died, which is bad.

I circumvented that by running paster non daemonized in a "screen". Simply type "screen" in your shell of choice, you will usually depending on your linux be presented with a virtual terminal, that will keep running even when you log out your remote session. Start paster as usually in your new "window" (the screen) with --reload but without daemon, and then detach the window, so you can return to your normal shell (detach = CTRL-A, then press D). You can re-enter that screen by typing "screen -r". If you would like to kill it, reconnect it (screen -r) and inside the screen type CTRL-A, then press K.

Hope that helps.

Tom