spanner-django logo spanner-django

☰
  • Install
  • Quickstart
    • From scratch
      • Tutorial 1
      • Tutorial 2
    • Existing apps
  • FAQ
Navigation :
navigation

spanner-django

Use Cloud Spanner as a database with Django

spanner-django is an integration that allows Django users to use Cloud Spanner as a database.

spanner-django brings Cloud Spanner as a database to Google Cloud Platform customers using Django.

Combine Cloud Spanner’s superior advantages with your favorite Python web framework. Your web applications can now be seemlessly deployed to Google Cloud’s fully managed, scalable, relational database service for regional and global application data with Cloud Spanner.

No need to add any code to your applications, or to learn any complex concepts. Simply add 2 lines of code to your settings.py file, for example.

# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'spanner.django',
        'PROJECT': 'apdev',
        'INSTANCE': 'dv1',
        'NAME': 'db2',
    }
}

run your usual Django migrations and that’s it, you’ll now be able to use Cloud Spanner and should see something like.

  • Tables and indices listing

  • Tables displayed

Getting started

You can get started by taking a look at these resources

How does it work?

Please see the diagram below:

Edit this page on Github
  • Github
spanner-django