Notes on Python projects.
NodeChef automatically detects your project as Python if you do not explicitly specify if one of the below conditions is met.
- Your project has a requirements.txt file in the root of the project folder.
- Or your project has a setup.py file in the root of the project folder.
Specify a Python version
You can specify the version of python to use by including it in the runtime.txt file in the root folder of your project. See example below:
Click here to see supported python versions
NodeChef always uses the latest version of the Python buildpack.
To request the latest Python version in a patch line, replace the patch version with x: 3.6.x To request the latest version in a minor line, replace the minor version: 3.x
Start command.
For python projects, specifying a start command is required. You can specify a start command in the root folder of your project by creating a file with name: Procfile.
An example python project with a Procfile See image below:
Example Procfile starting your app with a simple python script:
Example Procfile starting your app with gunicorn (Django apps):
Another example starting a Django app:
Example Procfile starting running your web app on Waitress:
Listening for connections
NodeChef automatically sets the environment varabile PORT at runtime. You must listen for connections using the value of this variable. See below example: