UPDATED: Changed to simpler python script
I have a website hosted in Google App Engine which is mostly static. Now I have a python script that would return a list of files under a specific folder in the server. I need this list of files in JavaScript.
helloworld.py
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, webapp2 World!')
app = webapp2.WSGIApplication([('/GetImages', MainPage)], debug=True)
I am calling this Python script in a <script> tag in my index.html using jQuery
$.ajax({
type: "GET",
url: "/GetImages",
dataType: "text",
success: function(data) {
alert(data);
}
});
In my app.yaml I have this handler defined and also other handlers for static files
- url: /GetImages
script: helloworld.app
I have started Google App Engine launcher, and when I open my site in localhost:8080/GetImages, I don't see the hello world string.
I think the problem is with my app.yaml. If I add below in the handlers, I get server error. Is this not allowed?
- url: /static
static_dir: static
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.