react-force-graph icon indicating copy to clipboard operation
react-force-graph copied to clipboard

How can I connect to 'flask'?

Open Lee-daeho opened this issue 4 years ago • 4 comments

Describe the bug A clear and concise description of what the bug is.

Hi, I'm trying to connect the html code to flask(python). When I load html only by IDE(Pycharm), it makes a proper result. But, when I load it by flask, the result says 'Uncaught (in promise) SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data'

Is there any possible way to connect it to flask? I need it because I have to 'execute' the html file with arguments.

Thank you

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem. image

Desktop (please complete the following information):

  • OS: [e.g. iOS] Ubuntu 18.04
  • Browser [e.g. chrome, safari] FireFox
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

Lee-daeho avatar Feb 22 '21 08:02 Lee-daeho

@Lee-daeho it's difficult to say without more context, but it appears the URL you're trying to load for the graph data may be returning something else other than a JSON response, causing the parser to choke.

I would look in the network tab to see if the data is being fetched correctly.

vasturiano avatar Feb 23 '21 00:02 vasturiano

Thanks for fast reply.

This is my fetch result. Fetch fail to load json.

image

I think url can't match the storage in local.

Is there any possible solution?

Lee-daeho avatar Feb 23 '21 04:02 Lee-daeho

@Lee-daeho this goes beyond the scope of this module and it's instead related to how your app is setup, but it looks like you don't have any resource behind that URL. See 404 status (not found).

vasturiano avatar Feb 23 '21 10:02 vasturiano

@vasturiano You are right. I think localhost:5000 is not connected to my local storage(somewhere /virtual is defined).

But, when I load the HTML file only, URL is connected well.

Lee-daeho avatar Feb 25 '21 15:02 Lee-daeho