• 06 Aug 2020
  • 1 Minute To Read
  • Contributors
  • Print
  • Share
  • Dark


  • Print
  • Share
  • Dark

You can run different types of applications on Python using Hostman: APIs, background workers, cron jobs, private services, and others.

Hostman provides CI/CD for all types of services as well as great scalability.

To deploy a Python application, click "Create a service" in the top-left corner in your Dashboard and choose Back-end application.

Screen Shot 2020-06-17 at 10.00.32 AM.png

Connect your Git account and choose the repository to deploy.

Like all back-end applications, a Python application must run on a specific cloud server. Choose the location and configuration of this cloud server. You can upgrade it in the future.

Screen Shot 2020-06-17 at 10.07.58 AM.png

Choose your framework in the App customization window.

Screen Shot 2020-06-17 at 10.26.48 AM.png

We use gunicorn to launch Python applications, as it is a reliable, fast and scalable WSGI server. Make sure that the Start command is filled in correctly. Here is the format:

gunicorn <directory>.<filename>:<application instance>

Click Deploy when you've checked all the parameters.


Django creates a file inside your project directory, so for a Django application the start command will be:

gunicorn <your-project-name>.wsgi

Other Python frameworks

If you have a file in the root directory with the content below, you'll probably use the command gunicorn main:app

import flask
app = flask.Flask(__name__)

Deployment process

You'll see the deployment process in the log. When it's complete, you'll receive a notification. You can also send these notifications to your Slack.

Usually it takes some time to install the cloud server during the first deployment.

What to do if deployment fails

First of all, check the deployment log. You'll see the stage where something went wrong.

The most common issues are with the launch command. Check that everything is working with gunicorn in your development environment. Check that all the modules your need to launch an application are in the requirements.txt file.

Also, we're here to help, so don't hesitate to ask us about the causes via chat.


DisallowedHost at /Invalid HTTP_HOST

This issue is caused by Django when you didn't set up the host name in file. It's a security measure to prevent HTTP Host header attacks.

What you want to do is to update file, changing ALLOWED_HOSTS to something like this:


or you can allow all domains this way if you don't want to use this security measure:

Was This Article Helpful?