Skip to main content
Python is a general purpose scripting language often used in web development. You can deploy Python apps on Upsun using a server or a project such as uWSGI.

Supported versions

You can select the major and minor version. Patch versions are applied periodically for bug fixes and the like. When you deploy your app, you always get the latest available patches.

Specify the language

To use Python, specify python as your app’s type: For example: * This version doesn’t receive any updates at all. You are strongly recommended to upgrade to a supported version.

Usage example

Run your own server

You can define any server to handle requests. Once you have it configured, add the following configuration to get it running on Upsun:
  1. Specify one of the supported versions:
  1. Install the requirements for your app.
  1. Define the command to start your web server:
You can choose from many web servers such as Daphne, Gunicorn, Hypercorn, and Uvicorn. See more about running Python web servers.

Use uWSGI

You can also use uWSGI to manage your server. Follow these steps to get your server started.
  1. Specify one of the supported versions:
  1. Define the conditions for your web server:
  1. Create configuration for uWSGI such as the following:
    config/uwsgi.ini
    [uwsgi]
    # Unix socket to use to talk with the web server
    # Uses the variable defined in the configuration in step 2
    socket = $(SOCKET)
    protocol = http
    
    # the entry point to your app
    wsgi-file = app.py
    
    Replace app.py with whatever your file is.
  2. Install the requirements for your app.
  1. Define the entry point in your app:
    # You can name the function differently and pass the new name as a flag
    # start: "uwsgi --ini conf/uwsgi.ini --callable <NAME>"
    def application(env, start_response):
    
        start_response('200 OK', [('Content-Type', 'text/html')])
        return [b"Hello world from Upsun"]
    

Package management

Your app container comes with pip pre-installed. For more about managing packages with pip, Pipenv, and Poetry, see how to manage dependencies. To add global dependencies (packages available as commands), add them to the dependencies in your app configuration: For example, to use pipenv to manage requirements and a virtual environment, add the following:

Connect to services

The following examples show how to access various services with Python. For more information on configuring a given service, see the page for that service.

Sanitizing data

By default, data is inherited automatically by each child environment from its parent. If you need to sanitize data in preview environments for compliance, see how to sanitize databases.

Frameworks

All major Python web frameworks can be deployed on Upsun. See dedicated guides for deploying and working with them:
Last modified on March 11, 2026