Welcome to Linode

When you start your flask server by running the command flask run in your terminal, you will get a message similar to this:

(venv)$ flask run

 * Serving Flask app 'blog.py' (lazy loading)
 * Environment: development
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 195-448-500

Of interest here is the environment used by the server. You can see that I have explicitly set flask to use a "development" server. Development servers are intended for use only during local development because they are designed not to be efficient, stable or secure.

Let us say you have completed building your application and you have hosted it in a remote version control system such as GitHub. Flask does not recommend the use of the built-in server in production because it does not scale. It recommends a few deployment options that you can take advantage of to properly run your flask app in production:

The services above are all hosted on the cloud and are designed to scale, be secure and stable. They are characterized by lifting the burden of setting up, configuring and maintaining the server from the developer.

Alternatively, you can choose to host a flask application yourself. This approach will allow you to learn the technical details that go into web hosting and server configuration and maintainance. During this tutorial, I will show how you can manually deploy your flask application on Linode. In particular, I will show you four things:

  1. How to deploy your flask app on Linode
  2. How to buy a domain name for your deployed application
  3. How to secure your domain with SSL
  4. How to monitor your server

The flask application demonstrated in the tutorials uses the file-based SQLite database. However, if you would like to know how to use PostgreSQL on a live Linux server, you can learn more by visiting Configure PostgreSQL in a Live Linux Server.

I won't lie to you, deploying an application can be overwhelming because there are a lot of different ways to do it. Knowing what is best for your specific application can also be difficult. Here, you will learn how to deploy your flask application to a Linux server using NGINX and GUNICORN.