title: Python+Altair (Vega-Lite): Web server
body: <p>I want to visualize some graphs on web pages using Python 2.7.12 and Altair 1.2.0.</p>
  
  <p>Using their examples it is easy and straightforward:</p>
  
  <pre><code>from altair import *
  from altair import Chart, load_dataset
  
  # load built-in dataset as a pandas DataFrame
  cars = load_dataset('cars')
  
  chart = Chart(cars).mark_circle().encode(
      x='Horsepower',
      y='Miles_per_Gallon',
      color='Origin',
  )
  
  chart.display()  
  </code></pre>
  
  <p>This works in Jupyter Notebook.</p>
  
  <p>Changing <code>chart.display()</code> to <code>chart.server()</code> (as described at <a href="https://altair-viz.github.io/documentation/displaying.html#displaying-plots-via-a-local-http-server" rel="nofollow noreferrer">https://altair-viz.github.io/documentation/displaying.html#displaying-plots-via-a-local-http-server</a>) should be enough to start a web server using Python's HTTPServer.</p>
  
  <p>It starts, but the page it provides is empty. The source is there but nothing is visualized.</p>
  
  <p>Any idea about why? </p>