From 04326801570d17918a48a9a64b164ea9464f3562 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 15 Oct 2020 14:10:20 +0100 Subject: added ability to set LOCAL_CLOUD_PROXY environment variable --- config/settings/gcloud_settings.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'config') diff --git a/config/settings/gcloud_settings.py b/config/settings/gcloud_settings.py index 8bb7574..3a8912f 100644 --- a/config/settings/gcloud_settings.py +++ b/config/settings/gcloud_settings.py @@ -199,6 +199,20 @@ if os.getenv('GAE_APPLICATION', None): 'NAME': 'ctrack', } } +elif os.getenv("LOCAL_CLOUD_PROXY", None): + # Running Cloud Proxy Locally. Make sure it's running separately. + # This allows for us to drop and create the database, update migrations, etc. + # Normal development happens with SQLite as described below. + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'HOST': '127.0.0.1', + 'USER': 'ctrack', + 'PORT': '3306', + 'PASSWORD': os.getenv('DATABASE_PASSWORD'), + 'NAME': 'ctrack', + } + } else: # Running locally so connect to either a local MySQL instance or connect to # Cloud SQL via the proxy. To start the proxy via command line: -- cgit v1.2.3