I had this problem.. check you have a static mapping in for favicon.ico in your app.yaml (and above your Init one) or just use "/" for your index handler.
Your "/.*" mapping will send all request to Init, including anything else the browser looks for like the favicon, images or scripts not caught with other handlers. So you end up processing a few extra requests each page load. On Feb 17, 4:25 am, NiceGuy <[email protected]> wrote: > I am having a strange problem, > > I have the following python script written in init.py > > import os > from google.appengine.ext.webapp import template > import cgi > import wsgiref.handlers > > from google.appengine.api import users > from google.appengine.ext import webapp > from google.appengine.ext import db > from google.appengine.api import mail > > class htmlFile(db.Model): > ua = db.StringProperty(multiline=False) > fn = db.StringProperty(multiline=False) > nm = db.IntegerProperty() > dt = db.DateTimeProperty(auto_now=True) > > class Init(webapp.RequestHandler): > def get(self): > > fns = ['AAA','BBB','CCC'] > > for c in fns: > ht = htmlFile() > ht.ua = "" > ht.fn = c > ht.nm = 0 > ht.put() > > path = os.path.join(os.path.dirname(__file__)+'/html/', > 'index.html') > self.response.out.write(template.render(path, { })) > > def main(): > application = webapp.WSGIApplication([('/*.*', Init)],debug=True) > wsgiref.handlers.CGIHandler().run(application) > > if __name__ == "__main__": > main() > > My app.yaml has the following line > > - url: /init.* > script: init.py > > THe problem is that from the browser i type localhost:8080/init and > the script gets executed twice which can be seen clearly from the > terminal output > > INFO 2009-02-17 04:15:00,090 dev_appserver.py] "GET /init HTTP/ > 1.1" 200 - > INFO 2009-02-17 04:15:00,107 dev_appserver_index.py] Updating / > home/awin/SRC/bt-labs/appengine/bttest/index.yaml > INFO 2009-02-17 04:15:00,138 dev_appserver.py] "GET /acrane.gif > HTTP/1.1" 200 - > INFO 2009-02-17 04:15:00,148 dev_appserver.py] "GET /jquery- > latest.js HTTP/1.1" 200 - > INFO 2009-02-17 04:15:00,166 dev_appserver.py] "GET /offdiag.gif > HTTP/1.1" 200 - > INFO 2009-02-17 04:15:00,175 dev_appserver.py] "GET /maindiag.gif > HTTP/1.1" 200 - > INFO 2009-02-17 04:15:00,198 dev_appserver.py] "GET /init HTTP/ > 1.1" 200 - > INFO 2009-02-17 04:15:00,255 dev_appserver.py] "GET /blog2.jpg > HTTP/1.1" 200 - > INFO 2009-02-17 04:15:00,270 dev_appserver.py] "GET / > bulletpoint.gif HTTP/1.1" 200 - > > So the datastore which is was supposed to have 3 entries is getting > six entries. > > I find this happening with soem of my other scripts also. > > I didnot go my app online due to this error. > > Earlier i thought it is a browser problem so i switched from Firefox > to Galen but again the smae thing happens... > > Please help me............ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
