Coder Social home page Coder Social logo

Comments (7)

erikwrede avatar erikwrede commented on June 23, 2024

You can pass graphiql=False as a kwarg, but maybe we should improve the wording on this, since we now support other explorers 😊

from strawberry.

patrick91 avatar patrick91 commented on June 23, 2024

@erikwrede maybe we should also support None?

from strawberry.

shmoon-kr avatar shmoon-kr commented on June 23, 2024

Thanks for your attention and fast reply. I tried graphiql=False but I still failed.

But then I noticed an interesting phenomenon.
When I run your suggestion (graphiql=False) with django debug server, (python ./manage.py runserver) it works correctly.
But I run it in a production environment it doesn't work.

I'm serving it with a uvicorn thread under gunicorn.
My command for a production environment is : gunicorn -k uvicorn.workers.UvicornWorker --workers 2 --threads 3
When I run the server with this command, graphiql=False parameter is ignored. I don't understand why.

I'm using django channels and I think this might have something to do with it.

Can you take a look at this one more time?

from strawberry.

shmoon-kr avatar shmoon-kr commented on June 23, 2024

I found the solution by myself.

When I use channels, graphiql option should be given for GraphQLHTTPConsumer. The following worked for me.
gql_http_consumer = AuthMiddlewareStack(GraphQLHTTPConsumer.as_asgi(schema=schema, graphql_ide=None))

Thanks.

from strawberry.

erikwrede avatar erikwrede commented on June 23, 2024

Keeping this open as this seems like a good case for a DevX improvement. @patrick91 I think =None is also an option.

from strawberry.

Birdi7 avatar Birdi7 commented on June 23, 2024

Hello! I was wondering if I could fix this. However, with the following code snippet I see no graphiql_ide. Can you check if it's fixed by now?

My urls.py in django project

from django.urls import path

from strawberry.django.views import AsyncGraphQLView

import typing
import strawberry


@strawberry.type
class Book:
    title: str
    author: str


def get_books():
    return [
        Book(
            title="The Great Gatsby",
            author="F. Scott Fitzgerald",
        ),
    ]


@strawberry.type
class Query:
    books: typing.List[Book] = strawberry.field(resolver=get_books)


schema = strawberry.Schema(query=Query)

urlpatterns = [
    path("graphql/", AsyncGraphQLView.as_view(schema=schema,
                                         graphql_ide=None)),
]

from strawberry.

patrick91 avatar patrick91 commented on June 23, 2024

@Birdi7 I don't think it has been fixed yet 😊

https://github.com/strawberry-graphql/strawberry/blob/main/strawberry/http/ides.py#L9-L30 we don't check for None here

from strawberry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.