I’m having some trouble loading external javascripts using google app engine.
I basically have an index.html file with the following on the header section:
<script type="text/javascript" src="/jsfunctions.js"></script>
and the following in the body section:
<p id="demo"></p>
<button type="button" onclick = DisplayDate() >Display Date</button>
In the jsfunctions.js file, I have:
function DisplayDate(){
document.getElementById("demo").innerHTML=Date();
}
When I run this, I can see that the page gets the jsfunctions.js:
INFO 2012-05-06 00:37:25,864 dev_appserver.py:2884] "GET /jsfunctions.js HTTP/1.1" 404
However, nothing happens when I click on the button.
Am I missing something important here?
Unless you declare a
static_filesentry forjsfunctions.js(or put it in a subdirectory that you declare withstatic_dir), your handler has to be prepared to serve it.See https://developers.google.com/appengine/docs/python/config/appconfig#Static_Directory_Handlers