Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a2f4c7f

Browse filesBrowse files
iotmanichenyumic
authored andcommitted
Fix for error when missing MySQLdb (GoogleCloudPlatform#1728)
* Fix for error when missing MySQLdb * Update settings.py * Update settings.py * Update settings.py
1 parent e461e9a commit a2f4c7f
Copy full SHA for a2f4c7f

File tree

Expand file treeCollapse file tree

1 file changed

+7
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-0
lines changed

‎appengine/standard_python37/django/mysite/settings.py

Copy file name to clipboardExpand all lines: appengine/standard_python37/django/mysite/settings.py
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@
7979
# Database
8080
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
8181

82+
# Install PyMySQL as mysqlclient/MySQLdb to use Django's mysqlclient adapter
83+
# See https://docs.djangoproject.com/en/2.1/ref/databases/#mysql-db-api-drivers for
84+
# more information
85+
import pymysql
86+
pymysql.install_as_MySQLdb()
87+
8288
# [START db_setup]
8389
if os.getenv('GAE_APPLICATION', None):
8490
# Running on production App Engine, so connect to Google Cloud SQL using
@@ -89,6 +95,7 @@
8995
'HOST': '/cloudsql/[YOUR-CONNECTION-NAME]',
9096
'USER': '[YOUR-USERNAME]',
9197
'PASSWORD': '[YOUR-PASSWORD]',
98+
'NAME': '[YOUR-DATABASE]',
9299
}
93100
}
94101
else:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.