Getting started with Django

Django apps that run on Google Cloud are running on the same infrastructure that powers all of Google's products, which generally improves scalability.

Hosting platforms

These are the available options for deploying Django on Google Cloud:

Django deployment option Use if you want Don't use if you need Get started
App Engine standard environment
  • Minimal configuration
  • No server maintenance
  • Easy scalability
  • Binary executables not available in the App Engine standard Python environment
Django on App Engine standard environment
App Engine flexible Environment
  • Most of the advantages of App Engine
  • Custom Docker runtimes
  • Control over the entire VM (outside of the application's docker container)
Django on App Engine flexible environment
Cloud Run (fully managed)
  • Django in a self-contained container environment
  • Serverless without App Engine
  • Fine-grained control over a self-contained series of microservices
  • Custom hardware like GPUs or a Kubernetes cluster
Django on Cloud Run (fully managed)

Django on Cloud Run with Cloud Code for VS Code

Django on Cloud Run with Cloud Code for IntelliJ
Google Kubernetes Engine (GKE)
  • Django containers in a microservice environment
  • A toolkit to design your own container-based platform
  • A fully featured platform and environment that lets developers build apps and services over the internet. For a container-based solution, consider App Engine flexible environment or Cloud Run.
Django on Google Kubernetes Engine
Compute Engine
  • Computing infrastructure that uses VMs
  • Windows VMs
  • A serverless environment that doesn't require you to configure your own infrastructure
Django in Google Cloud Marketplace


The Django object-relational mapper (ORM) works best with an SQL relational database. If you are starting a new project, Cloud SQL is a good choice. With a few clicks, you can create a MySQL or PostgreSQL database that's managed and scaled by Google.

You can also use other SQL databases if you're willing to manage them yourself on Compute Engine or another service.

Sometimes, there are compelling reasons to use a NoSQL database, such as scalability or suitability for your data model. Using the Django ORM with a NoSQL database is possible with some limitations: for example, many types of database joins can be expressed in Django, but these joins aren't supported by Datastore and other NoSQL databases like MongoDB.

One possibility is to use a mixed SQL and NoSQL approach that uses different databases for different types of data.

For a managed, massively scalable NoSQL solution, consider Datastore, which is a non-relational database that scales better than a SQL solution.

If you choose to use MongoDB, you can deploy it using Cloud Marketplace and do your own management, or you can use the managed MongoDB hosting service provided by mLab.

For many years, the most popular approach to making the Django ORM work with NoSQL solutions was Django non-rel, but the project isn't maintained. Another project, called Djangae, provides a Django ORM backend for Datastore without forking Django; however, it isn't supported on App Engine.


App Engine comes with a built-in memcache system. To install the memcache system on Compute Engine, use Cloud Marketplace. To install the memcache system on either Compute Engine or GKE, use the Memcached Docker image. Similarly, you can install Redis by using Cloud Marketplace or the Redis Docker image.

Task queuing

App Engine comes with a built-in task queue feature for long-running background jobs. Outside of App Engine, you can use Pub/Sub to queue tasks with Pub/Sub Task Queue for Python (psq).

Other popular task queuing options that are available in Cloud Marketplace include RabbitMQ and Kafka. There are also Docker images for RabbitMQ and Kafka.