From 306f7890fe71b457a403fc169138123d2d999ef0 Mon Sep 17 00:00:00 2001 From: Steven DeMartini Date: Thu, 1 Jun 2023 10:05:31 -0700 Subject: [PATCH 1/4] Add venv and .venv to gitignore since common venv paths --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index ff6bd968c..5cfaf0064 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ __pycache__/ # Distribution / packaging .Python env/ +venv/ +.venv/ build/ develop-eggs/ dist/ From 0d9142726aee60073b8bed775b5089c26b046512 Mon Sep 17 00:00:00 2001 From: Steven DeMartini Date: Thu, 1 Jun 2023 10:37:17 -0700 Subject: [PATCH 2/4] Update cookbook-plain app requirements and local-dev notes This also adds the DEFAULT_AUTO_FIELD to the app's Django settings to resolve this warning when running `migrate`: ``` ingredients.Category: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'. HINT: Configure the DEFAULT_AUTO_FIELD setting or the IngredientsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'. ``` --- examples/cookbook-plain/README.md | 9 +++++++++ examples/cookbook-plain/cookbook/settings.py | 16 +++++++++------- examples/cookbook-plain/requirements.txt | 7 +++---- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/examples/cookbook-plain/README.md b/examples/cookbook-plain/README.md index dcd242087..b120b7895 100644 --- a/examples/cookbook-plain/README.md +++ b/examples/cookbook-plain/README.md @@ -62,3 +62,12 @@ Now head on over to and run some queries! (See the [Graphene-Django Tutorial](http://docs.graphene-python.org/projects/django/en/latest/tutorial-plain/#testing-our-graphql-schema) for some example queries) + +Testing local graphene-django changes +------------------------------------- + +In `requirements.txt`, replace the entire `graphene-django=...` line with the following (so that we install the local version instead of the one from PyPI): + +``` +../../ # graphene-django +``` diff --git a/examples/cookbook-plain/cookbook/settings.py b/examples/cookbook-plain/cookbook/settings.py index 7eb9d5690..f07f6f6d4 100644 --- a/examples/cookbook-plain/cookbook/settings.py +++ b/examples/cookbook-plain/cookbook/settings.py @@ -5,10 +5,10 @@ Generated by 'django-admin startproject' using Django 1.9. For more information on this file, see -https://docs.djangoproject.com/en/1.9/topics/settings/ +https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see -https://docs.djangoproject.com/en/1.9/ref/settings/ +https://docs.djangoproject.com/en/3.2/ref/settings/ """ import os @@ -18,7 +18,7 @@ # Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ +# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = "_$=$%eqxk$8ss4n7mtgarw^5$8^d5+c83!vwatr@i_81myb=e4" @@ -81,7 +81,7 @@ # Database -# https://docs.djangoproject.com/en/1.9/ref/settings/#databases +# https://docs.djangoproject.com/en/3.2/ref/settings/#databases DATABASES = { "default": { @@ -90,9 +90,11 @@ } } +# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field +DEFAULT_AUTO_FIELD = "django.db.models.AutoField" # Password validation -# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators +# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { @@ -105,7 +107,7 @@ # Internationalization -# https://docs.djangoproject.com/en/1.9/topics/i18n/ +# https://docs.djangoproject.com/en/3.2/topics/i18n/ LANGUAGE_CODE = "en-us" @@ -119,6 +121,6 @@ # Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/1.9/howto/static-files/ +# https://docs.djangoproject.com/en/3.2/howto/static-files/ STATIC_URL = "/static/" diff --git a/examples/cookbook-plain/requirements.txt b/examples/cookbook-plain/requirements.txt index 85a896390..6e02745de 100644 --- a/examples/cookbook-plain/requirements.txt +++ b/examples/cookbook-plain/requirements.txt @@ -1,4 +1,3 @@ -graphene>=2.1,<3 -graphene-django>=2.1,<3 -graphql-core>=2.1,<3 -django==3.1.14 +django~=3.2 +graphene +graphene-django>=3.1 From 2947aa36a0393103ef588e4999663a6b4be6bb96 Mon Sep 17 00:00:00 2001 From: Steven DeMartini Date: Thu, 1 Jun 2023 10:39:10 -0700 Subject: [PATCH 3/4] Fix #1417 graphiql explorer styles by including official CSS Like in the official graphiql-plugin-explorer example here https://github.com/graphql/graphiql/blob/619864691941c46cc0b0848e8713028e20212c36/packages/graphiql-plugin-explorer/examples/index.html#L26-L29 Resolves https://github.com/graphql-python/graphene-django/issues/1417 --- graphene_django/templates/graphene/graphiql.html | 4 ++++ graphene_django/views.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/graphene_django/templates/graphene/graphiql.html b/graphene_django/templates/graphene/graphiql.html index ddff8fc8e..52421e868 100644 --- a/graphene_django/templates/graphene/graphiql.html +++ b/graphene_django/templates/graphene/graphiql.html @@ -21,6 +21,10 @@ integrity="{{graphiql_css_sri}}" rel="stylesheet" crossorigin="anonymous" /> + diff --git a/graphene_django/views.py b/graphene_django/views.py index 377b75d99..b16a12be3 100644 --- a/graphene_django/views.py +++ b/graphene_django/views.py @@ -78,6 +78,9 @@ class GraphQLView(View): graphiql_plugin_explorer_version = "0.1.15" graphiql_plugin_explorer_sri = "sha256-3hUuhBXdXlfCj6RTeEkJFtEh/kUG+TCDASFpFPLrzvE=" + graphiql_plugin_explorer_css_sri = ( + "sha256-fA0LPUlukMNR6L4SPSeFqDTYav8QdWjQ2nr559Zln1U=" + ) schema = None graphiql = False From 1d26152ddb2b86440336e12a9675b375bcc95c16 Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Fri, 2 Jun 2023 04:26:09 +0800 Subject: [PATCH 4/4] Update GraphiQL version --- graphene_django/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/graphene_django/views.py b/graphene_django/views.py index b16a12be3..3fb87d410 100644 --- a/graphene_django/views.py +++ b/graphene_django/views.py @@ -66,12 +66,12 @@ class GraphQLView(View): react_dom_sri = "sha256-nbMykgB6tsOFJ7OdVmPpdqMFVk4ZsqWocT6issAPUF0=" # The GraphiQL React app. - graphiql_version = "2.4.1" # "1.0.3" - graphiql_sri = "sha256-s+f7CFAPSUIygFnRC2nfoiEKd3liCUy+snSdYFAoLUc=" # "sha256-VR4buIDY9ZXSyCNFHFNik6uSe0MhigCzgN4u7moCOTk=" - graphiql_css_sri = "sha256-88yn8FJMyGboGs4Bj+Pbb3kWOWXo7jmb+XCRHE+282k=" # "sha256-LwqxjyZgqXDYbpxQJ5zLQeNcf7WVNSJ+r8yp2rnWE/E=" + graphiql_version = "2.4.7" + graphiql_sri = "sha256-n/LKaELupC1H/PU6joz+ybeRJHT2xCdekEt6OYMOOZU=" + graphiql_css_sri = "sha256-OsbM+LQHcnFHi0iH7AUKueZvDcEBoy/z4hJ7jx1cpsM=" # The websocket transport library for subscriptions. - subscriptions_transport_ws_version = "5.12.1" + subscriptions_transport_ws_version = "5.13.1" subscriptions_transport_ws_sri = ( "sha256-EZhvg6ANJrBsgLvLAa0uuHNLepLJVCFYS+xlb5U/bqw=" )