Harrison Harrison - 5 months ago 171
Python Question

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? I pressed
ctrl + c
in the terminal but I can still access the app through the browser. I'm wondering how to stop the app? Thanks.

I even rebooted the vps. After the vps is restated, the app still is running!


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. 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.

$ sudo a2ensite conf_filename.conf
$ sudo service apache2 restart

Now your site will be live again.