Push an App

Cloud Foundry automatically uses this buildpack if it detects a
requirements.txt or setup.py file in the root directory of your project.

If your Cloud Foundry deployment does not have the Python Buildpack installed, or the installed version is out of date, you can use the latest version by specifying it with the -b option when you push your app. For example:

Specify a Start Command

To stage with the Python buildpack and start an application, do one of the following:

Supply a Procfile. For more information about Procfiles, see the Configuring a Production Server topic. The following example Procfile specifies gunicorn as the start command for a web app running on Gunicorn:

web: gunicorn SERVER-NAME:APP-NAME

Specify a start command with -c. The following example specifies waitress-serve as the start command for a web app running on Waitress:

This error occurs because pip does not use system cerificates by default.
To resolve this issue, set the PIP_CERT environment variable in the manifest.yml file to point to the system certificate store.

For example:

---
env:
PIP_CERT: /etc/ssl/certs/ca-certificates.crt

Conda

To install dependencies using Conda, add a channels block to the environment.yml file.

In the channels block, list custom channels and add nodefaults. Specifying nodefaults tells Conda to only use the channels in the channels block.

For example:

channels:
- https://conda.example.com/repo
- nodefaults

If the private repository uses a custom SSL certificate that is installed on the platform, you may see an error similar to the following:

This error occurs because conda does not use system certificates by default.
To resolve this issue, set the CONDA_SSL_VERIFY environment variable in the manifest.yml file to point to the system certificate store.

For example:

---
env:
CONDA_SSL_VERIFY: /etc/ssl/certs/ca-certificates.crt

Parse Environment Variables

The cfenv package provides access to Cloud Foundry application environment settings by parsing all the relevant environment variables. The settings are returned as a class instance. See https://github.com/jmcarp/py-cfenv for more information.

To use Pipenv instead of pip (directly) for installing dependencies, place a Pipfile in the root directory. Easiest to let Pipenv generate this for you.

NLTK Support

To use NLTK corpora in your app, you can include an nltk.txt file in the root of your application. Each line in the file specifies one dataset to download.
The full list of data sets available this way can be found on the NLTK website. The id listed for the corpora on that page is the string you should include in your app’s nltk.txt.

Example nltk.txt:
brown
wordnet

Having an nltk.txt file only causes the buildpack to download the corpora. You still must specify NLTK as a dependency of your app if you want to use it to process the corpora files.

Proxy Support

If you need to use a proxy to download dependencies during staging, you can set
the http_proxy and https_proxy environment variables. For more information, see Using a Proxy .