You can now use composable image to install runtimes and tools in your application container. To find out more, see the Composable image topic.
Python is a general purpose scripting language often used in web development.
You can deploy Python apps on Upsun Cloud using a server or a project such as uWSGI.
You can select the major and minor version.Patch versions are applied periodically for bug fixes and other maintenance updates. By default, you get the latest available patches each time you deploy. If your project has a maintenance window configured, Upsun Cloud applies patches only during that window. Upsun Cloud may still apply urgent or critical fixes outside of the maintenance window.
The following versions are still available in your projects,
but they’re at their end of life and are no longer receiving security updates from upstream.
3.13
3.12
3.11
To ensure your project remains stable in the future, switch to a supported version.* This version doesn’t receive any updates at all.
You are strongly recommended to upgrade to a supported version.
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 2socket = $(SOCKET)protocol = http# the entry point to your appwsgi-file = app.py
Replace app.py with whatever your file is.
Install the requirements for your app.
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 Cloud"]
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:
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.You can access service credentials to connect to managed services from environment variables present in the application container.
Consult each of the individual service documentation to see how to retrieve and surface credentials into your application.
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.