Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion run/django/cloudmigrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
steps:
- id: "Build Container Image"
name: gcr.io/k8s-skaffold/pack
args: ["build", "${_IMAGE_NAME}", "--builder=gcr.io/buildpacks/builder"]
args: ["build", "${_IMAGE_NAME}", "--builder=gcr.io/buildpacks/builder:google-24"]

- id: "Push Container Image"
name: "gcr.io/cloud-builders/docker"
Expand Down
2 changes: 1 addition & 1 deletion run/django/e2e_test_setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ steps:

- id: "Build Container Image"
name: gcr.io/k8s-skaffold/pack
args: ["build", "${_IMAGE_NAME}", "--builder=gcr.io/buildpacks/builder",
args: ["build", "${_IMAGE_NAME}", "--builder=gcr.io/buildpacks/builder:google-24",
"--env", "GOOGLE_PYTHON_VERSION=${_PYTHON_VERSION}"]

- id: "Push Container Image"
Expand Down
16 changes: 15 additions & 1 deletion run/django/mysite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,26 @@
STORAGES = {
"default": {
"BACKEND": "storages.backends.gcloud.GoogleCloudStorage",
"options": {
"bucket_name": GS_BUCKET_NAME,
"querystring_auth": True, # Enable signed URLs
"default_acl": None, # No ACLs required due to uniform level access on your bucket
"expiration": 300,
"iam_sign_blob": True, # Use the IAM Sign Blob API
},
},
"staticfiles": {
"BACKEND": "storages.backends.gcloud.GoogleCloudStorage",
"options": {
"bucket_name": GS_BUCKET_NAME,
"querystring_auth": True, # Enable signed URLs
"default_acl": None, # No ACLs required due to uniform level access on your bucket
"expiration": 300,
"iam_sign_blob": True, # Use the IAM Sign Blob API
},
},
}
Comment on lines 174 to 195
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The options dictionary is duplicated for both the default and staticfiles storage configurations. To improve maintainability and follow the Don't Repeat Yourself (DRY) principle, consider defining these options once in a shared variable and referencing it in both places. This will make future updates to the storage configuration easier and less error-prone.

GS_DEFAULT_ACL = "publicRead"
GS_DEFAULT_ACL = None
# [END cloudrun_django_static_config]

# Default primary key field type
Expand Down
2 changes: 1 addition & 1 deletion run/django/noxfile_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

TEST_CONFIG_OVERRIDE = {
# You can opt out from the test for specific Python versions.
"ignored_versions": ["2.7", "3.6", "3.7", "3.8"],
"ignored_versions": ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Disabling tests for Python 3.10, 3.11, and 3.12 is a critical issue. These versions are supported by Django==6.0.2, which is being introduced in this PR. Instead of ignoring the tests, they should be fixed to ensure the sample works correctly with the new dependencies. Tests for unsupported Python versions (like 3.8 and 3.9 due to the Django upgrade) and very new versions (like 3.13) can be ignored, but not for the primary supported versions.

Suggested change
"ignored_versions": ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"],
"ignored_versions": ["2.7", "3.6", "3.7", "3.8", "3.9", "3.13"],

# Old samples are opted out of enforcing Python type hints
# All new samples should feature the
"enforce_type_hints": True,
Expand Down
5 changes: 2 additions & 3 deletions run/django/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Django==5.2.5; python_version >= "3.10"
Django==4.2.24; python_version >= "3.8" and python_version < "3.10"
Django==6.0.2
django-storages[google]==1.14.6
django-environ==0.12.0
psycopg2-binary==2.9.10
psycopg2-binary==2.9.11
gunicorn==23.0.0
google-cloud-secret-manager==2.21.1