Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Allow users to enable playground in production mode

Mikail KOCAKbd8c315ec693
diff --git a/saleor/graphql/views.py b/saleor/graphql/views.py
index 503e446916..2f92446b37 100644
--- a/saleor/graphql/views.py
+++ b/saleor/graphql/views.py
@@ -80,7 +80,7 @@ class GraphQLView(View):
def dispatch(self, request, *args, **kwargs):
# Handle options method the GraphQlView restricts it.
if request.method == "GET":
- if settings.DEBUG:
+ if settings.PLAYGROUND_ENABLED:
return render_to_response("graphql/playground.html")
return HttpResponseNotAllowed(["OPTIONS", "POST"])
diff --git a/saleor/settings.py b/saleor/settings.py
index 86bdfaf3a0..3ead81dc75 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -391,6 +391,8 @@ MAX_CHECKOUT_LINE_QUANTITY = int(os.environ.get("MAX_CHECKOUT_LINE_QUANTITY", 50
TEST_RUNNER = "tests.runner.PytestTestRunner"
+PLAYGROUND_ENABLED = get_bool_from_env("PLAYGROUND_ENABLED", DEBUG)
+
ALLOWED_HOSTS = get_list(os.environ.get("ALLOWED_HOSTS", "localhost,127.0.0.1"))
ALLOWED_GRAPHQL_ORIGINS = os.environ.get("ALLOWED_GRAPHQL_ORIGINS", "*")