Locally

Introduction

This guide will help you add sqlcommenter to your Django applications running locally.

Please see the reference for the fields added in the SQL comments google-cloud-sqlcommenter.Fields

Requirements

Steps Resource
Django https://docs.djangoproject.com/en/stable/intro/
google-cloud-sqlcommenter https://pypi.org/project/google-cloud-sqlcommenter
Django 2.X https://docs.djangoproject.com/en/stable/faq/install
Python 3.X https://www.python.org/downloads/

Addition to your code

Firstly, please install google-cloud-sqlcommenter.

For any Django deployment, we can just edit our settings.py file and update the MIDDLEWARE section as per:

MIDDLEWARE = [
  'google.cloud.sqlcommenter.django.middleware.SqlCommenter',
  ...
]
If any middleware execute database queries (that you'd like commented by SqlCommenter), those middleware MUST appear after 'google.cloud.sqlcommenter.django.middleware.SqlCommenter'

References

Resource URL
Django quickstart https://docs.djangoproject.com/en/stable/intro/
Installing Django middleware /python/django#installation