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 b524fc5

Browse filesBrowse files
ryanmatsJon Wayne Parrott
authored andcommitted
Django GKE tutorial: MySQL -> Postgres (GoogleCloudPlatform#905)
1 parent 8efd5f1 commit b524fc5
Copy full SHA for b524fc5

File tree

Expand file treeCollapse file tree

4 files changed

+12
-8
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+12
-8
lines changed
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Getting started with Django on Google Container Engine
22

33
This repository is an example of how to run a [Django](https://www.djangoproject.com/)
4-
app on Google Container Engine. It uses the [Writing your first Django app](https://docs.djangoproject.com/en/1
5-
.9/intro/tutorial01/) Polls application as the example app to deploy. From here on out, we refer to this app as
6-
the 'polls' application.
4+
app on Google Container Engine. It uses the
5+
[Writing your first Django app](https://docs.djangoproject.com/en/1.11/intro/tutorial01/)
6+
Polls application (parts 1 and 2) as the example app to deploy. From here on
7+
out, we refer to this app as the 'polls' application.
78

89

910
# Tutorial
@@ -12,9 +13,9 @@ See our [Django on Container Engine](https://cloud.google.com/python/django/cont
1213

1314
## Contributing changes
1415

15-
* See [CONTRIBUTING.md](CONTRIBUTING.md)
16+
* See [CONTRIBUTING.md](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/CONTRIBUTING.md)
1617

1718

1819
## Licensing
1920

20-
* See [LICENSE](LICENSE)
21+
* See [LICENSE](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/LICENSE)

‎container_engine/django_tutorial/mysite/settings.py

Copy file name to clipboardExpand all lines: container_engine/django_tutorial/mysite/settings.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,14 @@
8080
# [START dbconfig]
8181
DATABASES = {
8282
'default': {
83-
'ENGINE': 'django.db.backends.mysql',
83+
# If you are using Cloud SQL for MySQL rather than PostgreSQL, set
84+
# 'ENGINE': 'django.db.backends.mysql' instead of the following.
85+
'ENGINE': 'django.db.backends.postgresql',
8486
'NAME': 'polls',
8587
'USER': os.getenv('DATABASE_USER'),
8688
'PASSWORD': os.getenv('DATABASE_PASSWORD'),
8789
'HOST': '127.0.0.1',
88-
'PORT': '3306',
90+
'PORT': '5432',
8991
}
9092
}
9193
# [END dbconfig]

‎container_engine/django_tutorial/polls.yaml

Copy file name to clipboardExpand all lines: container_engine/django_tutorial/polls.yaml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ spec:
6464
- image: b.gcr.io/cloudsql-docker/gce-proxy:1.05
6565
name: cloudsql-proxy
6666
command: ["/cloud_sql_proxy", "--dir=/cloudsql",
67-
"-instances=<your-cloudsql-connection-string>=tcp:3306",
67+
"-instances=<your-cloudsql-connection-string>=tcp:5432",
6868
"-credential_file=/secrets/cloudsql/credentials.json"]
6969
volumeMounts:
7070
- name: cloudsql-oauth-credentials

‎container_engine/django_tutorial/requirements.txt

Copy file name to clipboardExpand all lines: container_engine/django_tutorial/requirements.txt
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ Django==1.10.5
22
mysqlclient==1.3.10
33
wheel==0.29.0
44
gunicorn==19.6.0
5+
psycopg2==2.7.1

0 commit comments

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