Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'PLAYGROUND_HTML' from 'ariadne.constants' #1046

Closed
aesavas opened this issue Mar 3, 2023 · 3 comments
Closed
Labels
question Further information is requested

Comments

@aesavas
Copy link

aesavas commented Mar 3, 2023

After updating v0.18.1, tests fail because ImportError: cannot import name 'PLAYGROUND_HTML' from 'ariadne. constants' . When I checked the changes, PLAYGROUND_HTML was removed from constants.py in this commit: 0fca6bb

So, is there any alternative way to use instead of PLAYGROUND_HTML?

@rafalp
Copy link
Contributor

rafalp commented Mar 3, 2023

We've removed PLAYGROUND_HTML since it was no longer used in Ariadne after we moved to GraphQL Explorers.

Where are you using PLAYGROUND_HTML?

@rafalp rafalp added the question Further information is requested label Mar 3, 2023
@aesavas
Copy link
Author

aesavas commented Mar 3, 2023

I checked Graphql Explorers, and it resolved my issue. I used PLAYGROUND_HTML in the view function (in Flask service). I returned PLAYGROUND_HTML in the GET request function. After the suggestion, I tried to use ExplorerApollo.html(). It handled failed tests. Thanks for help @rafalp

@aesavas aesavas closed this as completed Mar 3, 2023
@rafalp
Copy link
Contributor

rafalp commented Mar 3, 2023

Great! Remember that default explorers that Ariadne implements are pure and don't depend on request, so you can do EXPLORER_HTML = ExplorerApollo().html() outside of Flask view. to avoid template render that always renders same value.

We've updated Flask integration example for this change, but we are using GraphiQL in it:

https://ariadnegraphql.org/docs/flask-integration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants