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',
  ...
]

References

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