Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new django tutorial #4869

Merged
merged 119 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
ff73fca
Cloud Run with Django tutorial
glasnt May 4, 2020
b5ccc3c
Cloud Run with Django tutorial
glasnt May 4, 2020
6ea8b1b
Merge branch 'tutorial/django-run' of github.com:glasnt/python-docs-s…
glasnt May 4, 2020
1ba9285
black, .env file update
glasnt May 11, 2020
e6c9362
Document Dockerfile, add PYTHONUNBUFFERED
glasnt Jun 15, 2020
7cd94bb
Document cloudmigrate.yaml
glasnt Jun 15, 2020
01fbedf
Formatiting
glasnt Jun 15, 2020
711a50f
Bump django, remove mysql
glasnt Jun 15, 2020
b01118d
Merge branch 'master' into tutorial/django-run
glasnt Sep 28, 2020
97088bd
Update secretmanager
glasnt Oct 2, 2020
a3960e8
Update pinned dependencies
glasnt Oct 2, 2020
c0a4753
ensure path is set correctly with api update
glasnt Oct 2, 2020
e75ee59
format
glasnt Oct 2, 2020
55db6c4
Generalise cloudmigrate file
glasnt Oct 12, 2020
b0d3e61
update service default
glasnt Oct 12, 2020
b39521b
add tests
glasnt Oct 19, 2020
a0c90a4
Update CODEOWNERS
glasnt Oct 19, 2020
79a0c11
Merge branch 'master' into django-run
glasnt Oct 19, 2020
60f54fd
Merge branch 'master' into django-run
glasnt Oct 19, 2020
083145a
Licence headers
glasnt Oct 19, 2020
0508de3
Remove envvar declaration
glasnt Oct 19, 2020
4ae043e
cleanup readme
glasnt Oct 19, 2020
0fea1a4
Fix import names, region tags
glasnt Oct 19, 2020
59a690a
black
glasnt Oct 19, 2020
3297a13
Merge branch 'django-run' of github.com:glasnt/python-docs-samples in…
glasnt Oct 19, 2020
43311df
Cloud Run with Django tutorial
glasnt May 4, 2020
192547a
black, .env file update
glasnt May 11, 2020
4d8ec6f
Document Dockerfile, add PYTHONUNBUFFERED
glasnt Jun 15, 2020
9fb3094
Document cloudmigrate.yaml
glasnt Jun 15, 2020
885d44f
Formatiting
glasnt Jun 15, 2020
b56ecdf
Bump django, remove mysql
glasnt Jun 15, 2020
3897bad
Update secretmanager
glasnt Oct 2, 2020
a453f02
Update pinned dependencies
glasnt Oct 2, 2020
7981375
ensure path is set correctly with api update
glasnt Oct 2, 2020
756daf9
format
glasnt Oct 2, 2020
86573fe
Generalise cloudmigrate file
glasnt Oct 12, 2020
9a94cb2
update service default
glasnt Oct 12, 2020
6426d01
add tests
glasnt Oct 19, 2020
8fa8c19
Update CODEOWNERS
glasnt Oct 19, 2020
be5911a
Licence headers
glasnt Oct 19, 2020
cb5992e
Remove envvar declaration
glasnt Oct 19, 2020
8c643d4
cleanup readme
glasnt Oct 19, 2020
98837e1
Fix import names, region tags
glasnt Oct 19, 2020
5e1cb0a
black
glasnt Oct 19, 2020
0308d64
Merge branch 'django-run' of github.com:glasnt/python-docs-samples in…
glasnt Oct 19, 2020
911ca50
black
glasnt Oct 19, 2020
877c658
Format YAML
glasnt Oct 20, 2020
700a2cd
Merge branch 'master' into django-run
glasnt Nov 5, 2020
466a801
bump dependencies
glasnt Nov 5, 2020
c188733
Update var names, remove sql instance creation
glasnt Nov 5, 2020
4d33c68
PR Feedback
glasnt Nov 8, 2020
344f35e
Merge branch 'master' into django-run
glasnt Nov 8, 2020
3ed2a6e
Debug failing command
glasnt Nov 8, 2020
8fa7cc3
Merge branch 'django-run' of github.com:glasnt/python-docs-samples in…
glasnt Nov 8, 2020
8f854e9
Remove IAM calls - possible permissions issues
glasnt Nov 8, 2020
1809ab5
debug
glasnt Nov 8, 2020
cefb39a
force local settings if in nox/test
glasnt Nov 9, 2020
2b61310
add IDs to cloud build
glasnt Nov 11, 2020
cd0b8d1
Update region tags
glasnt Nov 11, 2020
9492d67
Get instance name from envvar
glasnt Nov 11, 2020
2601b22
Make secrets dynamic, optionally overload names by envvar
glasnt Nov 11, 2020
2ca3427
Remove create/destroy of static setting
glasnt Nov 11, 2020
f1b79c2
Consolidate envvars
glasnt Nov 11, 2020
e9cbe76
Merge branch 'master' into django-run
glasnt Nov 11, 2020
e8556fc
Merge branch 'django-run' of github.com:glasnt/python-docs-samples in…
glasnt Nov 11, 2020
738a9b5
fix region tags
glasnt Nov 11, 2020
e62e4d3
lint, import error
glasnt Nov 11, 2020
e51cd2b
Testing instance name is fqdn, need just name for gcloud sql calls
glasnt Nov 11, 2020
7837611
Ensure project specified on gcloud calls
glasnt Nov 11, 2020
460b5ff
set project when using gsutil
glasnt Nov 11, 2020
6fce68c
order of flags in gsutil matters
glasnt Nov 11, 2020
2b09698
ensure all subprocesses include project
glasnt Nov 11, 2020
cb5ea1e
Add and remove more project tags
glasnt Nov 11, 2020
9877d70
Update comments
glasnt Nov 11, 2020
04c0900
match on exact project name, not substring
glasnt Nov 11, 2020
895f8fb
lint
glasnt Nov 11, 2020
05aa42c
Can't hide the settings name in the setting itself 🧐
glasnt Nov 11, 2020
1db86b5
big oof
glasnt Nov 11, 2020
d8a557f
migrations require __init__.py to be detected
glasnt Nov 11, 2020
87ebb84
Bump overnight patch
glasnt Nov 11, 2020
adc6fda
Debug 503
glasnt Nov 11, 2020
4a956fb
Service requires custom settings envvar
glasnt Nov 12, 2020
9a48ab4
attempt fixing local tests
glasnt Nov 12, 2020
6d544f2
lint
glasnt Nov 12, 2020
7986d66
Merge branch 'master' into django-run
glasnt Nov 12, 2020
7ffff2d
revert accidental appengine change
glasnt Nov 12, 2020
d529d19
envvars
glasnt Nov 12, 2020
e6caaf7
Merge branch 'django-run' of github.com:glasnt/python-docs-samples in…
glasnt Nov 12, 2020
1edf555
ohno
glasnt Nov 12, 2020
d95a698
wrong varname
glasnt Nov 12, 2020
9bf42d4
Merge branch 'master' into django-run
glasnt Nov 12, 2020
28b12a0
Merge branch 'master' into django-run
glasnt Nov 16, 2020
c55cdea
Merge branch 'master' into django-run
glasnt Nov 17, 2020
c7034b1
Update run/django/noxfile_config.py
glasnt Nov 17, 2020
14371a4
Add licence header
glasnt Nov 17, 2020
e31e692
Formatting
glasnt Nov 17, 2020
e4dd31f
black
glasnt Nov 17, 2020
8712b3f
Add typehinting, remove debugging
glasnt Nov 18, 2020
eeca3c2
Merge branch 'master' into django-run
glasnt Nov 23, 2020
652d5ee
⚠️ noxfile change - add typehints
glasnt Nov 23, 2020
08d2961
⚠️ noxfile change - fix method signature
glasnt Nov 23, 2020
e441b59
⚠️ noxfile change - fix nox session type
glasnt Nov 23, 2020
763ad5b
⚠️ noxfile change - import order
glasnt Nov 24, 2020
82df36f
hadolint Dockerfile
glasnt Nov 24, 2020
5395697
revert hadolint
glasnt Nov 24, 2020
620b626
Merge branch 'master' into django-run
glasnt Nov 24, 2020
e1d465c
Merge branch 'master' into django-run
glasnt Nov 24, 2020
4f1063a
Merge branch 'master' into django-run
glasnt Nov 25, 2020
0d78748
Merge branch 'master' into django-run
glasnt Nov 25, 2020
80c66ab
Merge branch 'master' into django-run
glasnt Nov 30, 2020
2fd21a4
Merge branch 'master' into django-run
glasnt Dec 2, 2020
a18d3fe
Add linking
glasnt Dec 2, 2020
5e78fdb
Remove gcloudignore
glasnt Dec 2, 2020
2109542
Merge branch 'django-run' of github.com:glasnt/python-docs-samples in…
glasnt Dec 2, 2020
6f9c0ff
Merge branch 'master' into django-run
glasnt Dec 2, 2020
7dd2052
Merge branch 'master' into django-run
glasnt Dec 2, 2020
60699a9
Testing: i have a theory this is why tests started failing
glasnt Dec 2, 2020
2574096
Merge branch 'django-run' of github.com:glasnt/python-docs-samples in…
glasnt Dec 2, 2020
83fc6b2
Merge branch 'master' into django-run
glasnt Dec 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ensure path is set correctly with api update
  • Loading branch information
glasnt committed Oct 19, 2020
commit 7981375ad4a9ab555d3e34048c66e8aa2f9f6bc3
4 changes: 2 additions & 2 deletions run/django/mysite/migrations/0001_createsuperuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ def createsuperuser(apps, schema_editor):
# Retrieve secret from Secret Manager
_, project = google.auth.default()
client = sm.SecretManagerServiceClient()
path = f"projects/{project}/secrets/superuser_password/versions/latest"
admin_password = client.access_secret_version(path).payload.data.decode("UTF-8")
name = f"projects/{project}/secrets/superuser_password/versions/latest"
glasnt marked this conversation as resolved.
Show resolved Hide resolved
admin_password = client.access_secret_version(name=name).payload.data.decode("UTF-8")

# Create a new user using acquired password
from django.contrib.auth.models import User
Expand Down
4 changes: 2 additions & 2 deletions run/django/mysite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
client = sm.SecretManagerServiceClient()

SETTINGS_NAME = os.environ.get("SETTINGS_NAME", "django_settings")
path = f"projects/{project}/secrets/{SETTINGS_NAME}/versions/latest"
payload = client.access_secret_version(path).payload.data.decode("UTF-8")
name = f"projects/{project}/secrets/{SETTINGS_NAME}/versions/latest"
payload = client.access_secret_version(name=name).payload.data.decode("UTF-8")

with open(env_file, "w") as f:
f.write(payload)
Expand Down