Django Hosting & Deployment Options
Updated
Table of Contents
If you ask five Django developers for the best hosting option, you'll likely receive five different answers. Everyone has a different preference based on their own experience and project needs. Ultimately, though, we can divide hosting options into three main categories:
- 1. Dedicated Server: a physical server sitting in a data center that belongs exclusively to you. Generally, only the largest companies adopt this approach since it requires a lot of technical expertise to configure and maintain.
- 2. Virtual Private Server (VPS): a server can be divided into multiple virtual machines that use the same hardware, which is much more affordable than a dedicated server. This approach also means you don't have to worry about maintaining the hardware yourself.
- 3. Platform as a Service (PaaS): a managed VPS solution that is pre-configured and maintained, making it the fastest option to deploy and scale a website. It typically comes with a managed database, as well. The downside is that a developer cannot access the same degree of customization that a VPS or a dedicated server provides. And at scale, PaaS's can become quite expensive.
The choices here are all about tradeoffs. Many Django developers and small companies are happy using a PaaS to abstract away many of the difficulties inherent in putting code into production. If you are new to deployment, a PaaS is also a good idea to deploy a website quickly. Larger companies and developers with more experience tend to prefer VPS options that provide (and require) total control, resulting in a lower hosting bill but more up-front developer time.
Until recently, Heroku offered a generous free tier, but as of November 2022, that is no longer the case. As a result, you will need to pay for hosting now, and the more you spend, the more features you receive.
What follows is a list of the most popular PaaS and VPS options for Django as of 2024:
Platform-as-a-Service Options
Heroku
Heroku is the original PaaS that features a robust add-on ecosystem for additional services like database hosting, caching, logging, and more. It is still a stable, mature host relying on a Git-based deployment system. Check out the Heroku Django Getting Started Guide for more information.
Fly.io
Fly is a newer Docker-based hosted option with physical servers worldwide to be closer to users. Most other PaaS options rent space from a larger provider like AWS and act as an abstraction layer on top. Fly has PostgreSQL clusters, a tiered pricing scheme, and a lot of momentum. Check out their Django docs to get started quickly with a new or existing site.
Render
Render is a new but quite popular cloud option that allows for direct deployment from Github or Gitlab, similar to Heroku. It has options for hosted databases, cron jobs, and more. Check out its Django guide for more information.
Digital Ocean
Digital Ocean's App Platform rolls everything you need into an easy-to-use UI, combined with Digital Ocean's long history as a stable hosting platform. Check out this tutorial to get up and running quickly with hosted database and fast deploys.
Railway
Railway is a newer hosting provider that comes with pre-made templates for a number of frameworks including Django.
Platform.sh
Platform.sh uses YAML files to define builds, deploys, and access. You can seamlessly add workers such as Celery and message queues, and automatic backups are included.
PythonAnywhere
Recently acquired by Anaconda, PythonAnywhere is another PaaS option specializing in online Python environments. Plans start at $5/month. Deploying an existing Django app is straightforward and also demonstrated as part of the excellent DjangoGirls Tutorial.
Appliku
Appliku is a Django-focused service makes it easier to deploy on either AWS or Digital Ocean. Add your server, Git repo, and deploy in five minutes.
Microsoft Azure
A managed PaaS option that includes a nice video tutorial series with my DjangoChat podcast co-host Carlton Gibson.
Google Cloud
Google provides multiple PaaS options, starting with App Engine and more advanced options, including Kubernetes and Compute Engine.
Dokku
A lightweight, open source Docker-powered PaaS that promises to be cheaper than alternatives. There are some good tutorials on using it.
CapRover
CapRover is a free and open-source PaaS that can be used on top of a Digital Ocean droplet. It requires more configuration than paid options but also more potential savings.
AWS Elastic Beanstalk
Elastic Beanstalk is Amazon's PaaS option that does all the work to create an EC2 instance, install apps, configure a load balancer, and so on. It is suited to scaling an existing or new application that expects significant traffic.
Virtual Private Servers
Amazon EC2
For better or worse, EC2 is often the default choice for an enterprise-level scalable VPS since it is built on top of AWS's vast ecosystem of services and offers some of the lowest prices around. It allows you to launch as many virtual servers as you need with full flexibility, control, scalability, and customization. However, learning to navigate AWS correctly can require years of experience, so the potential cost savings come at the cost of many hours of developer education to use it efficiently. Developers typically use a managed database via RDS as well.
Digital Ocean
Digital Ocean is a simpler but cost-effective solution for small-to-medium-sized projects. If you're comfortable doing basic server configuration for as little as $5/month, you can host your entire Django project on Digital Ocean. They have [fantastic documentation](https://www.digitalocean.com/community/tags/django?type=tutorials, one-click installs for common setups like Ubuntu, and managed databases. Overall, Digital Ocean is far easier to use than AWS so if you are a solo developer or small team, it might be a better option.
Linode
Linode is another very popular VPS provider that starts at $5/month and has fantastic customer support. It has fallen slightly in popularity lately but still has many strong advocates.
Google Compute Engine
Compute Engine is Google's VPS option built on top of the global infrastructure that runs Google's search engine, Gmail, YouTube, and other platforms. If you already use Google Cloud options, it is a solid option that allows for maximum scalability and flexibility with a slightly less confusing user interface than AWS.
Microsoft Azure
Azure is Microsoft's option for enterprise-ready VPSs that interact well with the Microsoft ecosystem. Like GCP, it is slightly less complicated than AWS but still has a learning curve.
Ultimately, the choice for a VPS typically comes down to two considerations. If you know how to configure everything from scratch, most Django developers will reach for either EC2 or Digital Ocean. If you are a company, choosing between Amazon, Google, or Microsoft depends on what other services you need from them or are already using.