Deploy Django to Render
This page explains how to deploy Django on Render
Render fully supports Python-based applications and this page explains the steps that any developer can follow and deploy their apps using a minimal configuration.
Any Django project can be deployed in two ways:
- As a Service: the deployed app runs standalone (not connected with other services)
- As a Blueprint, where the Django App can be connected with other local services like cron, background tasks, or a React UI.
This page covers the case when Django is deployed as a service.
✅ Deploy as a Service
To deploy Django as a service, the steps are:
- Create a new Render account using GitHub
- Using GitHub for authentication facilitates the deployment of the project from the sources directly
- Navigate to the main Dashboard
- Create a
New Service
- Connect a GitHub Repository. For DEMO we will use:
- Configure the project
- Name
- Runtime: Needs to be Python
- Build Command
- this is responsible to install modules, collect statics, and build DB
- Start Command
- here we need to call
Gunicorn
using theapp entry point
as input
- here we need to call
- Select the Instance Type
- For this DEMO we will use a free one
- Optionally, we can specify
ENV Variables
, and disable theauto-deploy
- Confirm the action
- click on
Create Service
- click on
The steps with the related screens, are listed below:
Create new Service
Connect
a GitHub Repository
This demonstration uses Datta Able Django
Naming the Service
Configure
the Service
This step is quite important because we need to inform Render that our project needs Python to run, and also what should be executed before going live. This open-source starter combines the build set up in single file named build.sh responsible with the following tasks:
- Upgrade PIP (recommended to use a newer version)
- Install modules via PIP
- Collect Static
- Migrate DB
Another important setting is the Start Command
that specify the entry point to be used by Gunicorn
. For this starter, this is the value.
$ gunicorn core.wsgi:application
Configure
the Instance
Here we have two options: Free & Paid. For this deployment, a free instance was selected.
Confirm
& View Deployment Logs
Once the above set up is confirmed, Render will create a new page for the sevice where we can visualize the deployment logs and later, update the service settings.
Access the LIVE Deployment
At this point, the app should be up & running in the same way as Datta Able Deployment
✅ Resources
- 👉 Access AppSeed and start your next project
- 👉 Deploy Projects on Aws, Azure and Digital Ocean via DeployPRO
- 👉 Create an amazing landing page with Simpllo, an open-source site builder
- 👉 Django App Generator - A 2nd generation App Builder