views:

52

answers:

1

I deployed an app to Google App Engine. When I navigate to it, I get this:

Error: Server Error

The server encountered an error and could not complete your request.

If the problem persists, please report your problem and mention this error message and the query that caused it.

All the pages do this. appcfg.py upload_data doesn't work either. I'm not sure why. Am I doing something wrong here?

As an aside, it feels like sometimes I spend more time wrestling with GAE than I do actually writing code. (Although it's possible that my frustration is entirely my own fault.)

A: 

If you build your application abject (assuming you're using the webapp microframework that comes with App Engine, since you haven't mentioned that crucial detail;-) in the following way...:

application = webapp.WSGIApplication(url_to_handlers, debug=True)

the debug=True means you should be seeing a traceback in the browser for your exceptions, making debugging far easier. (The url_to_handlers is a list of pairs (url, handler), and of course I'm assuming you've imported webapp appropriately, etc etc).

Just about every framework has debugging facilities that are at least equivalent (or better, e.g. showing a page in which by suitable clicking you can expand nested frames and examine each frame's local variables) so this should not be hard to do whatever other framework you may be using (and it's advisable until you feel your app is really solid -- after that, once you open it up beyond a small alpha-test layer of friends, you probably don't want to bother your users with full tracebacks... though I've seen many web pages do that, in all kinds of different languages and frameworks, it's still not the best user experience;-).

Most any exception that occurs only when deploying to production but isn't reproduced in the local SDK in strict mode means a weakness in the SDK, btw, and it's a good idea (once you know exactly what happened) to post a bug in the SDK's tracker. (Some things that may reasonably considered exceptions to this general rule include timeout problems, since the exact performance and workload of the deployment servers at any given time are of course essentially impossible to reproduce with any accuracy on your local SDK, so the SDK basically doesn't even try;-).

Alex Martelli
Yes, it does work fine on the devserver, and I have set `debug=True`, even as deployed. But I'm not seeing tracebacks. Are they disabled for production? How can I diagnose this further?
Rosarch
@Rosarch, `debug=True` is performed at application level, so it works in deployed apps as well as in the SDK. To debug anyway, add explicit `logging` calls along the path that your code should follow when serving your request so you can narrow down, by bisection, the problem spot -- e.g., start with say half a dozen ones (one at the very start, one at the very end, a few others in strategically placed spots), see the last one that occurs and the first one that doesn't, add another 4 or so logically-between them, etc. (Give a little useful info on each, e.g. a few vars' values, if easy).
Alex Martelli