Deploy Python projects from GitLab, GitHub or BitBucket repository.

In addition to deployment via Git, NodeChef also supports deploying Python projects by uploading from the dashboard or using the NodeChef CLI. See the menu on your left hand side on how to deploy by uploading your project folder from the dashboard.

NodeChef cloud supports deploying your Python projects together with a MongoDB, MySQL or PostgreSQL database if required with a few clicks. We automatically build your project and run it in Docker containers on bare metal servers for the best performance.

More details on NodeChef Python cloud hosting and what features are supported.

We support integrations with GitLab, GitHub or BitBucket making it easy to deploy code living in your repository to your app containers running on NodeChef.

To deploy, follow the below three steps and your Python app will be up and running in the cloud in no time. After deployment, you can proceed to add your custom domain.

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:

python-3.5.2

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:

web: python app.py

Example Procfile starting your app with gunicorn (Django apps):

web: gunicorn SERVER-NAME:APP-NAME

Another example starting a Django app:

web: gunicorn --bind 0.0.0.0:$PORT mysite.wsgi:application

Example Procfile starting running your web app on Waitress:

web: waitress-serve --port=$PORT DJANGO-WEB-APP.wsgi:MY-APP

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:

if __name__ == "__main__": port = int(os.getenv("PORT", 8080)) app.run(host='0.0.0.0', port=port)