I have small app in appengine. Every request hits the server twice in my local dev server.
In debug mode i can see that the get method called twice. Its happening in both chrome and firefox browsers. here is the log from my localserver..INFO 2011-03-12 00:44:31,076 dev_appserver.py:3317] "GET /movie/tanu_weds_manu/rating-review-video HTTP/1.1" 200 -
INFO 2011-03-12 00:44:32,345 dev_appserver.py:3317] "GET /css/fb.css HTTP/1.1" 200 -
INFO 2011-03-12 00:44:32,588 dev_appserver.py:3317] "GET /css/wianga-movie.0.1.css HTTP/1.1" 200 -
INFO 2011-03-12 00:45:46,648 dev_appserver.py:3317] "GET /movie/tanu_weds_manu/rating-review-video HTTP/1.1" 200 -
INFO 2011-03-12 00:45:46,911 dev_appserver.py:3317] "GET /img/wianga-fb-50.gif HTTP/1.1" 200 -
INFO 2011-03-12 00:45:47,177 dev_appserver.py:3317] "GET /img/arrow_green.gif HTTP/1.1" 200 -
INFO 2011-03-12 00:45:47,470 dev_appserver.py:3317] "GET /image/movie/tanu_weds_manu HTTP/1.1" 200 -
INFO 2011-03-12 00:45:47,717 dev_appserver.py:3317] "GET /js/jquery.qtip-1.0.0-rc3.min.js HTTP/1.1" 200 -
INFO 2011-03-12 00:45:47,970 dev_appserver.py:3317] "GET /js/wianga.0.1.js HTTP/1.1" 200 -
INFO 2011-03-12 00:46:37,473 dev_appserver.py:3317] "GET /movie/tanu_weds_manu/rating-review-video HTTP/1.1" 200 -
Updated: Its getting worse,i cheked the logs in app console.There it hits more than 3 times for a request.
handlers:
- url: /favicon.ico
static_files: static/img/favicon.ico
upload: static/img/favicon.ico
- url: /robots.txt
static_files: static/robots.txt
upload: static/robots.txt
- url: /img
static_dir: static/img
- url: /images
static_dir: static/images
- url: /css
static_dir: static/css
- url: /js
static_dir: static/js
- url: /image/.*
script: /wianga/pages/common/ImageController.py
- url: /task/.*
script: /wianga/pages/task/TaskController.py
- url: /browse/.*
script: /wianga/site/Browse.py
- url: /movie/(.*)/rating-review-video/
script: /wianga/site/MoviePage.py
- url: /movie/(.*)/rating-review-video
script: /wianga/site/MoviePage.py
- url: /404
script: /wianga/404/404.py
- url: /api/.*
script: /wianga/api/ApiController.py
- url: /.*
script: /wianga/site/Home.py
Am getting same behavior in hellowrld application from appengine turorial... App.yaml
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: helloworld.py
Lo开发者_如何学Gog for hello world example for single request...
INFO 2011-03-12 06:08:06,299 dev_appserver_main.py:507] Running application wianga-movie on port 8080: http://localhost:8080
INFO 2011-03-12 06:08:12,506 dev_appserver.py:3317] "GET / HTTP/1.1" 200 -
INFO 2011-03-12 06:08:13,721 dev_appserver.py:3317] "GET / HTTP/1.1" 200 -
INFO 2011-03-12 06:08:13,838 dev_appserver.py:3317] "GET /favicon.ico HTTP/1.1" 200 -
INFO 2011-03-12 06:08:13,953 dev_appserver.py:3317] "GET / HTTP/1.1" 200 -
When I set up my app.yaml I just poured through this page: http://code.google.com/appengine/docs/python/config/appconfig.html You have to think like a regular expression parser. Anything that fails to match the preceding expressions will fall through to your wildcard handler and cause weirdness.
One thing I notice is that you should add login: admin
to your task queue handler. This will prevent external requests from hitting that URL accidentally.
Also, when you are submitting tasks to your handler, if you don't include the trailing slash (/task?blah=something
instead of /task/?blah=something
) the request would fall through to your wildcard handler and get sent to Home.py. That could also happen for /image/
, /browse/
and /api/
. You should put logging calls into those handlers to make sure they are getting called when expected.
Nothing jumps out at me as obviously wrong in your app.yaml though. But since there are GETs showing up in your log, that indicates that something is requesting that URL, and it's not just the get
method getting called twice internally.
Edit:
Hold on a sec, just noticed that you have this in your app.yaml twice. You shouldn't need to do that.
- url: /movie/(.*)/rating-review-video/
script: /wianga/site/MoviePage.py
- url: /movie/(.*)/rating-review-video
script: /wianga/site/MoviePage.py`
Try replacing with:
- url: /movie/(.*)/rating-review-video.*
script: /wianga/site/MoviePage.py`
Edit2:
Try adding this to the top of your get
method:
logging.info('environ: ' + str(self.request._environ))
Pop the output into a beautifier ( http://jsbeautifier.org/ ) to make it more readable, and take a look at the REQUEST_METHOD, QUERY_STRING, HTTP_USER_AGENT, HTTP_COOKIE, PATH_INFO, and HTTP_REFERER params to see where the requests are actually coming from. If they are all coming from your browser then there is something weird in your html, like hidden iframes (are you using Channel API?).
Also, try going to http://localhost:8080/_ah/admin/queues and making sure there aren't any old tasks hanging around.
精彩评论