在Digitalocean上运行Python应用程序

发布于 2025-02-01 05:33:54 字数 238 浏览 4 评论 0原文

我需要帮助才能在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

九歌凝 2025-02-08 05:33:54

您可以使用屏幕nohup使您的Python脚本运行24/7。

屏幕允许您创建一个终端会话并脱离它,从而使该过程开始运行。您可以使用以下命令在Ubuntu上安装它。请参阅此教程以获取更多信息。

sudo apt-get update sudo apt-get install screen

nohup允许您执行相同的操作。它基本上运行一个命令,忽略挂断信号,而在您注销时不会停止。与不同,屏幕NOHUP通常已经在Ubuntu上安装了。请参阅其手动页面有关它的更多信息。

最后,如果您有兴趣了解屏幕nohup之间的差异,则在此 post

You could use screen or nohup 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.

sudo apt-get update sudo apt-get install screen

nohup allows you to do the same. It basically runs a command ignoring hangup signals, not stopping when you log out. Unlike screen, 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 screenand nohup, they were explained in this post.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文