Paste (Python) Web Server - Autoreload Problem

断了今生、忘了曾经 提交于 2019-12-30 10:35:31

问题


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'


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/1252885/paste-python-web-server-autoreload-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!