This is an example of how to set up a Django application to deploy on Kinsta’s Application Hosting services.

Django is a Python-based web framework, so Kinsta automatically installs dependencies defined in your requirements.txt file during the build process.

The python manage.py collectstatic command executes at every build to collect all static files to the directory defined in STATIC_ROOT.

  1. Fork this GitHub repository: Kinsta – Hello World – Django.
  2. In MyKinsta, add an application with the Hello World – Django repository.
  3. In Environment variables, in Key 1 enter SECRET_KEY, and in Value 1, add a random string, select Available during runtime and Available during build process.
  4. In Set up your processes, in the Start command enter gunicorn helloworld.wsgi.

The app is available as soon as the build finishes, and the default Django page confirming successful installation loads at your application’s URL.

Successful installation of Django.
Successful installation of Django.

Environment Variables

The SECRET_KEY should not be stored in your repository but rather set up in an environment variable with a random string.

Web Server Setup

Start Command

When you deploy an application, Kinsta automatically creates a process based on the Procfile in the root of the repository. Make sure to use this command to run your server:

web: gunicorn helloworld.wsgi