You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to connect a Django instance to Google Cloud MySQL using django-environ in a codelab, and found an error in the parsing of DATABASES_URL for google cloud.
The url set in .env was: DATABASE_URL="mysql://djuser:hidden-password@//cloudsql/arvore-codelab:us-central1:mysqlinstance/mydatabase"
Fix in settings.py
# Set this value from django-environ
DATABASES = {"default": env.db()}
print(DATABASES)
if "/" in DATABASES["default"]["NAME"]:
DATABASES["default"]["HOST"], DATABASES["default"]["NAME"] = DATABASES["default"]["NAME"].rsplit('/', 1)
print(DATABASES)
I was trying to connect a Django instance to Google Cloud MySQL using django-environ in a codelab, and found an error in the parsing of DATABASES_URL for google cloud.
The url set in
.env
was:DATABASE_URL="mysql://djuser:hidden-password@//cloudsql/arvore-codelab:us-central1:mysqlinstance/mydatabase"
Fix in
settings.py
Log during building in Google Cloud Build:
This issue was discussed here googlecodelabs/feedback#964 (comment), with the help of google codelab team.
Hope this helps improving django-environ.
The text was updated successfully, but these errors were encountered: