Question

How come my website isn't hosted 24/7?

Posted November 27, 2021 100 views
UbuntuFlask

Howdy everyone, sorry in advance if this is a silly question, I’m still pretty new to linux & digitalocean, and I’m having a bit of an issue.

How come whenever I close the droplet’s web console tab, my website stops responding?

I’m using Ubuntu linux, and the droplet says its still on, but for some reason the website is only hosted when I’m in the console. I also have to manually run the flask app again to get the website up and running.

Could somebody tell me how I could keep my flask application running 24/7? I’m sure this is just some small step I forgot about.

Thanks!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

You need to run the flask application with something like gunicorn.

Kindly check this article for how to deploy your application 24/7. That way, when you close your console tab, your website will keep running.

https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-20-04

by Kathleen Juell
by Mark Drake
In this guide, you will build a Python application using the Flask microframework on Ubuntu 20.04. The bulk of this article will be about how to set up the uWSGI application server and how to launch the application and configure Nginx to act as a front-end reverse proxy.

Hi @gabrielgavrilov11,

As @seanmavley mentioned in order to run your flask application even after you close your Console, you need another service.

Another option for your Flask app is the PM2 service. You can check this tutorial from ore information on how to install and configure it : Install and configure PM2

by Lisa Tagliaferri
by Kathleen Juell
Node.js is an open-source JavaScript runtime environment for building server-side and networking applications. The platform runs on Linux, macOS, FreeBSD, and Windows. Though you can run Node.js applications at the command line, this tutorial will…