javascript - Not able to read external file using D3.js -


this question has answer here:

i not able read data csv or json file using d3js in flask application.

here code of:

html:

    <head>   <meta charset="utf-8">     <title>d3js</title>     <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script> </head> <body>  <script>      d3.csv("../data.csv", function (data) {         console.log(data);      });  </script>  </body> 

flask app.py code:

from flask import flask, render_template  app = flask(__name__)   @app.route('/') def hello_world():     return render_template('historgram.html')    if __name__ == '__main__':     app.run(debug=true) 

i receiving file not found error. failed load resource: server responded status of 404 (not found)

if data.csv static data, have move file directory static/ accessible flask server , access via

d3.csv("/static/data.csv", function (data) {     console.log(data);  }); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -