how to run background job in web.py?

五迷三道 提交于 2019-12-25 07:47:57

问题


  1. I use web.py to process incoming data by "GET" and "POST" method and uses app.run(). This looks will run in loop and never stop.

  2. I also have a background job which detect port "9xxx" and process the incoming data, send msg to other servers to push msg to phone. I also uses a while(true) loop to do this.

How to integrate (2) into (1)? I'm confused.

I used to plan run (1) and (2) independently but there has data exchange so not convenience to code. how do you web.py users do these similar things?


回答1:


I think this is what you want:

nohup python web.py > web.log 2>&1 &

Check out nohup wiki and man page

In production ,I'd like combine web.py with uwsgi and nginx.You can read this and have a try.And then I use supervisord to restarts server after they terminate.



来源:https://stackoverflow.com/questions/41544274/how-to-run-background-job-in-web-py

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