This is an example of how to set up a Django application to deploy on Kinsta’s Application Hosting services from a GitHub repository.
Django is a Python-based web framework, so Kinsta automatically installs dependencies defined in your requirements.txt file during the build process.
python manage.py collectstatic command executes at every build to collect all static files to the directory defined in
- Log in to GitHub and create a new repository from this template (Use this template > Create a new repository): Kinsta – Hello World – Django.
- In MyKinsta, add an application with the Hello World – Django repository.
- 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. The Start command can be left blank for the web process as Kinsta automatically detects the required command from the Procfile in the repository.
The app is available as soon as the build finishes, and the default Django page confirming successful installation loads at your application’s URL.
Prefer to watch the video version?
SECRET_KEY should not be stored in your repository but rather set up in an environment variable with a random string.
Web Server Setup
When you deploy an application and include a Procfile in the repository, Kinsta automatically creates a web process based on the Procfile in the root of the repository. Use this command in your Procfile to run your web server:
web: gunicorn helloworld.wsgi