Django apps that run on GCP are running on the same infrastructure that powers all of Google's products, which generally improves scalability.
There are four main options for deploying Django on GCP:
|Django deployment option||Use if you want||Don't use if you need||Get started|
|App Engine standard environment||
||Django on App Engine standard environment|
|App Engine flexible Environment||
||Django on App Engine flexible environment|
|Google Kubernetes Engine (GKE)||
||Django on Google Kubernetes Engine|
||Django in GCP 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 Cloud 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 Cloud Datastore, which is a non-relational database that scales better than a SQL solution.
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 Cloud 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 GCP Marketplace. To install the memcache system on either Compute Engine or GKE, use the Memcached Docker image. Similarly, you can install Redis by using GCP Marketplace or the Redis Docker image.