1

I've split handlers between 2 python files (main.py and main_cms.py). app.yaml defines the URLs that each python file will handle.

When I look at the Appstats, only the handlers from one of the 2 python files are profiled (the ones from main.py). The 'magic' of webapp_add_wsgi_middleware(app) always used to work just fine, until the split. How can I make Appstats recording apply to all handlers?

appengine_config.py:

def webapp_add_wsgi_middleware(app):     
    from google.appengine.ext.appstats import recording
    app = recording.appstats_wsgi_middleware(app)
    return app

app.yaml:

builtins:
- appstats: on

...

- url: /services/.*
  script: main.application

- url: /cms.*
  script: main_cms.application

main.py and main_cms.py:

application = webapp2.WSGIApplication(url_mapping, config=config)

Running python2.7 / GAE 1.6.3, the dev_appserver.py shows Appstats correct for all handlers. The described problem is only seen in production.

Ray
  • 2,472
  • 18
  • 22
kvdb
  • 725
  • 6
  • 18
  • I'm guessing a bit here, but do you also have the following in both main and main_cms: run_wsgi_app(application) – dragonx Mar 16 '12 at 15:21
  • I see what you're after, but I'm running python-2.7 (it was already tagged as such, but I'll mention it in the question as well). From what I read here, its only required for python 2.5? http://code.google.com/intl/nl-NL/appengine/docs/python/tools/webapp/running.html – kvdb Mar 16 '12 at 15:54
  • You're right, the run_wsgi_app() call is not needed in Py27. Could you try adding "import appengine_config" in make_cms.py? That's the only thing I can think of. – Guido van Rossum Mar 17 '12 at 05:03
  • @GuidovanRossum Please don't use comments to answer the question. Use the "Your Answer" box to post an answer, that way your answer can be accepted by the author of the question. – compie Mar 17 '12 at 16:27
  • I don't really care about my reputation :-) and I was far from sure that that was the right answer, otherwise I would have used the answer box. I think there's a bug somewhere if that import was needed. – Guido van Rossum Mar 18 '12 at 04:00

0 Answers0