GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use env variables for database. · msedebay-git/cloud-code-samples@bb13631

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .templates
    • template_location.json
  • python/django/python-guestbook
    • kubernetes-manifests
      • guestbook-app.deployment.yaml
      • guestbook-app.migration.yaml
    • src/guestbook
      • settings.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.templates/template_location.json‎

Copy file name to clipboardExpand all lines: .templates/template_location.json
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
"templatePath": "python-guestbook",
1212
"templateName": "Python: Guestbook"
1313
},
14-
{
15-
"repoPath": "https://github.com/GoogleCloudPlatform/cloud-code-samples.git",
16-
"directoryPath": "python/django/python-guestbook",
17-
"templatePath": "python-guestbook",
18-
"templateName": "Python: Django: Guestbook"
19-
},
2014
{
2115
"repoPath": "https://github.com/GoogleCloudPlatform/cloud-code-samples.git",
2216
"directoryPath": "golang/go-hello-world",
Collapse file

‎python/django/python-guestbook/kubernetes-manifests/guestbook-app.deployment.yaml‎

Copy file name to clipboardExpand all lines: python/django/python-guestbook/kubernetes-manifests/guestbook-app.deployment.yaml
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,12 @@ spec:
3030
image: python-guestbook
3131
ports:
3232
- containerPort: 8080
33+
env:
34+
- name: DATABASE_NAME
35+
value: "postgres"
36+
- name: DATABASE_USER
37+
value: "postgres"
38+
- name: DATABASE_HOST
39+
value: "python-guestbook-db"
40+
- name: DATABASE_PORT
41+
value: "5432"
Collapse file

‎python/django/python-guestbook/kubernetes-manifests/guestbook-app.migration.yaml‎

Copy file name to clipboardExpand all lines: python/django/python-guestbook/kubernetes-manifests/guestbook-app.migration.yaml
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,13 @@ spec:
2222
- name: python-guestbook-migration
2323
image: python-guestbook
2424
command: [ "/bin/sh", "-c", "python manage.py migrate" ]
25+
env:
26+
- name: DATABASE_NAME
27+
value: "postgres"
28+
- name: DATABASE_USER
29+
value: "postgres"
30+
- name: DATABASE_HOST
31+
value: "python-guestbook-db"
32+
- name: DATABASE_PORT
33+
value: "5432"
2534
restartPolicy: OnFailure
Collapse file

‎python/django/python-guestbook/src/guestbook/settings.py‎

Copy file name to clipboardExpand all lines: python/django/python-guestbook/src/guestbook/settings.py
+10-5Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@
2020
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
2121

2222
# SECURITY WARNING: keep the secret key used in production secret!
23-
SECRET_KEY = ')#53(g@x1pk#h9$&nb(-*2$y8xbi-(x(=i5n8n5(mr&v^eer!8'
23+
# See https://docs.djangoproject.com/en/2.2/ref/settings/#secret-key
24+
# You can generate a secret key using the following code:
25+
#
26+
# from django.core.management.utils import get_random_secret_key
27+
# get_random_secret_key()
28+
SECRET_KEY = 'CHANGE_ME_PLEASE'
2429

2530
# SECURITY WARNING: don't run with debug turned on in production!
2631
DEBUG = True
@@ -77,10 +82,10 @@
7782
DATABASES = {
7883
'default': {
7984
'ENGINE': 'django.db.backends.postgresql',
80-
'NAME': 'postgres',
81-
'USER': 'postgres',
82-
'HOST': 'python-guestbook-db',
83-
'PORT': '5432',
85+
'NAME': os.getenv('DATABASE_NAME'),
86+
'USER': os.getenv('DATABASE_USER'),
87+
'HOST': os.getenv('DATABASE_HOST'),
88+
'PORT': os.getenv('DATABASE_PORT'),
8489
}
8590
}
8691

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.