Skip to content

Commit

Permalink
Fix for error when missing MySQLdb (#1728)
Browse files Browse the repository at this point in the history
* Fix for error when missing MySQLdb

* Update settings.py

* Update settings.py

* Update settings.py
  • Loading branch information
iotmani authored and chenyumic committed Oct 11, 2018
1 parent e461e9a commit a2f4c7f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions appengine/standard_python37/django/mysite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@
# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases

# Install PyMySQL as mysqlclient/MySQLdb to use Django's mysqlclient adapter
# See https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-db-api-drivers for
# more information
import pymysql
pymysql.install_as_MySQLdb()

# [START db_setup]
if os.getenv('GAE_APPLICATION', None):
# Running on production App Engine, so connect to Google Cloud SQL using
Expand All @@ -89,6 +95,7 @@
'HOST': '/cloudsql/[YOUR-CONNECTION-NAME]',
'USER': '[YOUR-USERNAME]',
'PASSWORD': '[YOUR-PASSWORD]',
'NAME': '[YOUR-DATABASE]',
}
}
else:
Expand Down

0 comments on commit a2f4c7f

Please sign in to comment.