Sunday, April 28, 2013

flot not working when page is served by Django

Hi all,

I'm trying to get any simple flot graph to display at this point. my index.html template file is as shown below. If I load the html file in a browser directly it works great.  When served through django dev server the page is blank.
I have added the following to my settings to ensure that i am pointing to directory where js libraries are:


There are no errors in the dev server console when loading the page.

Any ideas? 



<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Sample chart</title>
<link href="file:///home/matt/Web/flot/examples/examples.css" rel="stylesheet" type="text/css">
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="file:///home/matt/Web/flot/excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="file:///home/matt/Web/flot/jquery.js"></script>
<script language="javascript" type="text/javascript" src="file:///home/matt/Web/flot/jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="file:///home/matt/Web/flot/jquery.flot.pie.js"></script>
<script type="text/javascript">
$(document).ready(function () {

var data = [
    { label: "IE",  data: 19.5},
    { label: "Safari",  data: 4.5},
    { label: "Firefox",  data: 36.6},
    { label: "Opera",  data: 2.3},
    { label: "Chrome",  data: 36.3},
    { label: "Other",  data: 0.8}

$.plot($("#placeholder"), data, 
        series: {
            pie: { 
                show: true
        legend: {
            show: false

// Add the Flot version string to the footer

$("#footer").prepend("Flot " + $.plot.version + " &ndash; ");


<div id="content">

<div class="demo-container">
<div id="placeholder" class="demo-placeholder"></div>


You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment