Skip to content

Commit 769049b

Browse files
authored
Change Django sample so that mysqlclient is not installed by default (GoogleCloudPlatform#2218)
1 parent 3234af6 commit 769049b

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

appengine/flexible/django_cloudsql/mysite/settings.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,34 @@
7878
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
7979

8080
# [START dbconfig]
81+
82+
# The following DATABASES configuration is for PostgreSQL. If you are using
83+
# MySQL, use the commented-out block that follows this one instead. In this
84+
# case, please also follow the commented instructions in requirements.txt.
85+
8186
DATABASES = {
8287
'default': {
83-
# If you are using Cloud SQL for MySQL rather than PostgreSQL, set
84-
# 'ENGINE': 'django.db.backends.mysql' instead of the following.
8588
'ENGINE': 'django.db.backends.postgresql',
8689
'NAME': 'polls',
8790
'USER': '<your-database-user>',
8891
'PASSWORD': '<your-database-password>',
89-
# For MySQL, set 'PORT': '3306' instead of the following. Any Cloud
90-
# SQL Proxy instances running locally must also be set to tcp:3306.
9192
'PORT': '5432',
9293
}
9394
}
95+
96+
# Uncomment this DATABASES block and use it instead of the above if you are
97+
# using MySQL. Also follow the commented instructions in requirements.txt.
98+
99+
# DATABASES = {
100+
# 'default': {
101+
# 'ENGINE': 'django.db.backends.mysql',
102+
# 'NAME': 'polls',
103+
# 'USER': '<your-database-user>',
104+
# 'PASSWORD': '<your-database-password>',
105+
# 'PORT': '3306',
106+
# }
107+
# }
108+
94109
# In the flexible environment, you connect to CloudSQL using a unix socket.
95110
# Locally, you can use the CloudSQL proxy to proxy a localhost connection
96111
# to the instance
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Django==2.1.9
2-
mysqlclient==1.4.1
2+
# mysqlclient==1.4.1 # Uncomment this line if using MySQL
33
wheel==0.32.3
44
gunicorn==19.9.0
5-
psycopg2==2.7.7
5+
psycopg2==2.7.7 # Comment this line out if using MySQL

0 commit comments

Comments
 (0)