I am learning D3 and I am trying to set up a local server on a mac machine to host a webpage. I follow these steps
- Set up the local server using:
python -m SimpleHTTPServer 8888 &
- Access the index file using:
http://localhost:8888
Here are the problems I am facing.
When I try step 2 I get the following messages on terminal
127.0.0.1 - - [25/Aug/2014 12:14:52] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [25/Aug/2014 12:14:52] code 404, message File not found 127.0.0.1 - - [25/Aug/2014 12:14:52] "GET /d3/d3.v3.js HTTP/1.1" 404 - 127.0.0.1 - - [25/Aug/2014 12:14:53] code 404, message File not found 127.0.0.1 - - [25/Aug/2014 12:14:53] "GET /favicon.ico HTTP/1.1" 404 -
When I open the index file directly it does not open via the local web server and instead opens with the following address "file://.../Users/d3_book/index.html" Here is the code (without the html tags) for my index file
<head> <meta charset="utf-8"> <title>D3 Page Template</title> <script type="text/javascript" src="../d3/d3.v3.js"></script> </head> <body> <script type="text/javascript"> // D3 code will go here </script> </body>