How to Restart Gunicorn in Linux


In this article, we show how to restart the gunicorn server in linux.

Gunicorn is an HTTP server that allows Python code to run on the web. Gunicorn is compatible with many various web frameworks, such as Django, for example.

Gunicorn is used frequently with nginx to serve web pages written in Python.

So to restart the gunicorn server, we would use the following code shown below.

This line of code above restarts the gunicorn server.

Why is this important to do?

Because if we're running a website, let's say a website using Django, if we make any changes to any of the Python (.py) web pages, then we need to restart the gunicorn server in order for the changes to be updated.

So when you're running a Python website, using a web framework such as Django and you make changes to an existing page or add a new page, you need to restart the gunicorn server in order for the changes to be made.

So basically you will be restarting the gunicorn server any time you make any changes to your website. This may not be true for all servers but it is true for most.

Below this is shown in the linux shell.

How to restart gunicorn in linux

If nothing shows up after you type in this command, then it was successfully done.

Realize that the user that you are logged into in the linux shell must have sudo privileges in order to execute this command.

You're updating the website. You're restarting the server. So you must have superuser privileges.

And this is how to restart gunicorn in linux.

Related Resources

How to Randomly Select From or Shuffle a List in Python

HTML Comment Box is loading comments...