简体   繁体   English

如何停止烧瓶app.run()?

[英]How to stop flask app.run()?

I made a flask app following flask's tutorial. 我按照烧瓶的教程做了一个烧瓶应用程序。 After python flaskApp.py , how can I stop the app? python flaskApp.py ,我该如何停止应用程序? I pressed ctrl + c in the terminal but I can still access the app through the browser. 我在终端中按了ctrl + c但我仍然可以通过浏览器访问该应用程序。 I'm wondering how to stop the app? 我想知道如何停止应用程序? Thanks. 谢谢。

I even rebooted the vps. 我甚至重新启动了vps。 After the vps is restated, the app still is running! 重新调整vps后,应用程序仍在运行!

CTRL+C is the right way to quit the app, I do not think that you can visit the url after CTRL+C. CTRL + C是退出应用程序的正确方法,我不认为您可以在CTRL + C之后访问该URL。 In my environment it works well. 在我的环境中它运作良好。

What is the terminal output after CTRL+C? CTRL + C后的终端输出是多少? Maybe you can add some details. 也许你可以添加一些细节。

You can try to visit the url by curl to test if browser cache or anything related with browser cause this problem. 您可以尝试通过curl访问url来测试浏览器缓存或与浏览器相关的任何内容是否会导致此问题。

Since you are using apache so in order to stop your app, you have to disable it by deleting .conf file from '/etc/apache2/sites-enabled/' folder and then restart the apache server. 由于您正在使用apache以便停止您的应用程序,您必须通过从'/ etc / apache2 / sites-enabled /'文件夹中删除.conf文件来禁用它,然后重新启动Apache服务器。 This will surely destroy your current running session. 这肯定会破坏你当前的运行会话。

$ cd /etc/apache2/sites-enabled/
$ sudo rm conf_filename.conf
$ sudo service apache2 restart

Try it and your site will be down. 尝试一下,您的网站将会关闭。 To enable it again, copy paste your file to '/etc/apache2/sites-available/' and run the following commands to enable it again. 要再次启用它,请将文件粘贴到“/ etc / apache2 / sites-available /”并运行以下命令再次启用它。

$ sudo a2ensite conf_filename.conf
$ sudo service apache2 restart

Now your site will be live again. 现在您的网站将重新上线。

Have you tried pkill python ? 你试过pkill python吗? WARNING : do not do so before consulting your system admin if are sharing a server with others. 警告 :如果与其他人共享服务器,请在咨询系统管理员之前不要这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM