Hi, ALL,
I'm getting an error 304 trying to locate the JavaScript files on my
dev machine.
Here's what I did.
I created a project and then created an application according to the tutorial.
Looking at
https://docs.djangoproject.com/en/1.5/howto/static-files/ I
made sure that "STATIC" environment variable is defined.
Here is my structure:
artefacts (project)
|
|----------------> (settings.py, urls.py, wsgi.py)
|
displayusbdata (application)
|
|---------------> (admin.py, models.py, tests.py, views.py)
|
|--------------> static
|
|------------> jqwidgets-ver3.1.0 (JavaScript files)
|
templates
|
|----------------> html
|
|-------------------> index.html
Now, the page (index.html) loads fine. When I go to "View->Source" (I
use IE here) I can see the code of the page.
Here is this code:
[code]
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
{% load staticfiles %}
<link rel="stylesheet" href="{% static
"jqwidgets-ver3.1.0/jqwidgets/styles/jqx.base.css" %}" type="text/css"
/>
<script type="text/javascript" src="{% static "jquery-1.10.2.js" %}"></script>
<script type="text/javascript" src="{% static
"jqwidgets-ver3.1.0/jqwidgets/jqxcore.js" %}"></script>
<script type="text/javascript" src="{% static
"jqwidgets-ver3.1.0/jqwidgets/jqxdata.js" %}"></script>
<script type="text/javascript" src="{% static
"jqwidgets-ver3.1.0/jqwidgets/jqxscrollbar.js" %}"></script>
<script type="text/javascript" src="{% static
"jqwidgets-ver3.1.0/jqwidgets/jqxgrid.js" %}"></script>
<script type="text/javascript" src="{% static
"jqwidgets-ver3.1.0/jqwidgets/jqxgrid.sort.js" %}"></script>
<script type="text/javascript" src="{% static
"jqwidgets-ver3.1.0/jqwidgets/jqxgrid.filter.js" %}"></script>
<script type="text/javascript" src="{% static
"jqwidgets-ver3.1.0/jqwidgets/jqxgrid.aggregates.js" %}"></script>
<script type="text/javascript" src="{% static
"jqwidgets-ver3.1.0/jqwidgets/jqxgrid.selection.js" %}"></script>
<script type="text/javascript" src="{% static
"jqwidgets-ver3.1.0/jqwidgets/jqxgrid.pager.js" %}"></script>
<script type="text/javascript" src="{% static
"jqwidgets-ver3.1.0/jqwidgets/jqxgrid.grouping.js" %}"></script>
<script type="text/javascript">
var data = "{{usb_data}}";
$(document).ready(function(){
var source =
{
localdata: data,
datatype: "json",
datafields:
[
{ name: '"device_name"', type: 'string' },
{ name: '"vid_pid"', type: 'date' },
{ name: '"install"', type: 'date' },
{ name: '"disk_device"', type: 'date' },
{ name: '"volume_device"', type: 'date' },
{ name: '"usb_type"', type: 'string' },
{ name: '"vid"', type: 'string' },
{ name: '"pid"', type: 'string' },
{ name: '"hub"', type: 'number' }
],
id: '"pk"',
root: '"fields"'
};
var dataAdapter = new $.jqx.dataAdapter(source)
//initialize jqxGrid
$("#grid").jqxGrid(
{
source: dataAdapter,
showstatusbar: true,
editable: false,
columns:
[
{ text: 'Device Name', columntype: 'textbox',
datafield: '"device_name"', width: 100 },
{ text: 'VID/PID', columntype: 'textbox', datafield:
'"vid_pid"', width: 50 },
{ text: 'Install', columntype: 'textbox', datafield:
'"install"', width: 50 },
{ text: 'Disk Device', columntype: 'textbox',
datafield: '"disk_device"', width: 50 },
{ text: 'Volume Device', columntype: 'textbox',
datafield: '"volume_device"', width: 50 },
{ text: 'Type', columntype: 'textbox', datafield:
'"usb_type"', width: 100 },
{ text: 'VID', columntype: 'textbox', datafield:
'"vid"', width: 100 },
{ text: 'PID', columntype: 'textbox', datafield:
'"pid"', width: 100 },
{ text: 'Hub', datafield: '"hub"',
cellsalign: 'right', cellsformat: 'n2' }
]
});
});
</script>
</head>
<body>
<div id='jqxWidget'>
<div id="grid"></div>
</div>
</body>
</html>
[/code]
However, on the terminal of my developmental server I see following:
[16/Jan/2014 01:26:05] "GET /usb/ HTTP/1.1" 200 223915
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/styles/jqx.base.css HTTP/1.1" 304
0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxcore.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET /static/jquery-1.10.2.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxdata.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.sort.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxscrollbar.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.filter.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.selection.js HTTP/1.1"
304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.pager.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.grouping.js HTTP/1.1" 304
0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.aggregates.js HTTP/1.1"
304 0
Which means that the server returns the 304 error on my jQWidgets files.
What am I missing? Where should I put my jQWidgets files in order to
get 200 and see the page?
Thank you.