The Python language is officially supported on the platform.
To ensure our deployment system considers your application as a Python
application, a file
setup.py should be
present at the root of your project, defining the dependencies of your app.
The prefered way to manage dependencies and python version is by using the
pipenv tool. When creating a project with pipenv, the Python version is
frozen in the
Pipfile file, ie:
[requires] python_version = "3.6"
The deployment system will use this information to install the last available
version respecting this constraint, in the previous example Python
would be installed.
Python 2 and Python 3 are both completely supported, you can specify the
runtime version in the
runtime.txt file at the root of your repository.
runtime.txt which would install Python 3.7.0:
When the project is using
pipenv and contains a Pipfile and a
Pipfile.lock files, the following command is used to install dependencies:
requirements.txt file is present in your application, the dependencies
will be installed respecting this file with:
pip install -r requirements.txt
We handle most of the common frameworks. Obviously, Django is among them. You just need to
configure your application to bind the port defined by the environment variable
Specific Python Buildpack Hooks
You may want to trigger custom actions after a successful deployment. The postdeploy hook is exactly what you need. But your application may require some actions to be executed during the deployment.
The Python buildpack can execute two hooks: before and after the installation of Python and its
dependencies. They must be located in the
bin root folder of your application and be named
More information at https://github.com/Scalingo/python-buildpack.