Skip to content

Examples don't work #30

@Morreski

Description

@Morreski

Hi,

I followed the flask-sqlalchemy examples here (and the snippets in the project's Readme as well) but it didn't work out of the box. I had the following exception: AttributeError: 'Request' object has no attribute 'get' when trying to request from Graphiql.

After some fiddling with flask-sqlalchemy i solved the bug by passing a context argument to GraphQLView.as_view.

Here is my full url declaration:

app.add_url_rule(                                                                   
    '/graphql',                                                                     
    view_func=GraphQLView.as_view(                                                  
        'graphql',                                                                  
        schema=schema,                                                              
        graphiql=True,                                                         
        context={'session': db_session}                                             
    ),                                                                              
)

I don't know if this is the proper way to fix the problem, but thought it'll be useful to tell you about it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions