How Do You Get?

Snippet: Django in Cloud Run + Firebase Hosting

Some useful tips for running Django / Wagtail in Cloud Run and Firebase Hosting.

  1. This tutorial is a great resource: https://cloud.google.com/python/django/run
  2. Whitenoise gives a simple solution for static file serving from Django, and Firebase Hosting or CDN can provide caching.
  3. The following settings are needed:

# Cloudrun compatibility https://firebase.google.com/docs/hosting/manage-cache#using_cookies

# "Only the specially-named __session cookie is permitted to pass through to # the execution of your app."

SESSION_COOKIE_NAME = …

How this site works - SQLite + Cloudrun

This site is an experiment in running SQLite in production, with servers that auto-scale to zero.

The key point is to limit the site to a single instance, so any updates are going to one instance of the database.

Litestream is used to replicate the database to/from a storage bucket, providing backup, but also providing a mechanism to scale the app down to zero.

Benefits

  1. Cost: No need to have …