在Digitalocean上运行Python应用程序
我需要帮助才能在 digitalocean滴上启动我的Python应用程序。我设置了所有设置,现在可以运行我的python文件。但是,如果我关闭Ubuntu控制台 - 我的循环或任何其他代码(例如发送请求)完成。我想启动一台烧瓶服务器,该服务器将在机器工作时一直接收Webhooks( 24/7 )。如果不在桌面上的工作控制台,我该如何启动该过程?问题与烧瓶无关,仅与无尽的工作计划有关。谢谢。
I need help to start my Python application on DigitalOcean droplet. I set up all the settings and now can run my python file. But if I close the Ubuntu console - my loop or any other code (sending requests for example) finish. I want to start a Flask server which will receive webhooks all time when machine works (24/7). How can I start the process without working console on my Desktop? The question is not about Flask, only about endless working program. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
屏幕
或nohup
使您的Python脚本运行24/7。屏幕
允许您创建一个终端会话并脱离它,从而使该过程开始运行。您可以使用以下命令在Ubuntu上安装它。请参阅此教程或此以获取更多信息。nohup
允许您执行相同的操作。它基本上运行一个命令,忽略挂断信号,而在您注销时不会停止。与不同,屏幕
,NOHUP
通常已经在Ubuntu上安装了。请参阅其手动页面有关它的更多信息。最后,如果您有兴趣了解
屏幕
和nohup
之间的差异,则在此 post 。You could use
screen
ornohup
to have your python script running 24/7.screen
allows you to create a terminal session and detach from it, leaving the process started on it running. You can install it on Ubuntu with the command below. See this tutorial or this one for more information.nohup
allows you to do the same. It basically runs a command ignoring hangup signals, not stopping when you log out. Unlikescreen
,nohup
is normally already installed by default on Ubuntu. See its manual page for more information about it.Finally, in case you are interested in knowing more about the differences between
screen
andnohup
, they were explained in this post.