I am having the same issue.
I have also added favicon url in app.yaml.
Here's how my app.yaml looks like:

application: wallpipetest
version: 1
runtime: python
api_version: 1

handlers:
# static files url
- url: /static/
  static_dir: static/

- url: /favicon.ico
  static_files: static/img/favicon.ico
  upload: static/img/favicon.ico

# all url
- url: /.*
  script: main.py


*** And here's my main.py file

import logging
import cgi
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

from com.xyz.MainPage import MainPage

# here we are adding templates for extending django.
# For example, smart_if.py enhances the if condition checks.
webapp.template.register_template_library
('com.wallpipe.appManager.smart_if')

appUrl =  [
           ('/', MainPage),
           ('/abc', MainPage),
           ('/cde', MainPage),
           ('/fgh', MainPage),
           ('/ijk', MainPage)
          ]

# defining application here.
application = webapp.WSGIApplication(appUrl, debug=True)

def real_main():
    run_wsgi_app(application)

# this is only for profiling the project.
def profile_main():
    # This is the main function for profiling
    # We've renamed our original main() above to real_main()
    import cProfile, pstats, StringIO
    prof = cProfile.Profile()
    prof = prof.runctx("real_main()", globals(), locals())
    stream = StringIO.StringIO()
    stats = pstats.Stats(prof, stream=stream)
    stats.sort_stats("time")  # Or cumulative
    stats.print_stats(80)  # 80 = how many to print
    # The rest is optional.
    # stats.print_callees()
    # stats.print_callers()
    logging.info("Profile data:\n%s", stream.getvalue())

def main():
    profile_main()

if __name__ == "__main__":
    main()


* I tried the case where I basically have an empty html file that is
being called but still browser calls the same url twice.
* I did put a debug:
        logging.info("URL: " + self.request.path_qs)
  to see what exactly is the url and it shows the same url for both
the calls.
* Also, since my application file is MainPage.py, I removed everything
from there and just put a single logging statement. And still the same
result. Two requests and sometimes three.


Any ideas?????

Regards,
Pankaj Vishwani



On Feb 17, 4:54 am, Anthony <[email protected]> wrote:
> I had this problem.. check you have a static mapping in forfavicon.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 thefavicon, 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 executedtwicewhich 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to