Reputation: 93
I am having a problem that has baffled me for over a week. I have a project that is written in python with Django on Google App Engine. The project has a login page and when I run the application in Google App Engine or from the command line using dev_server.py c:\project, it works fine. When I try to run the application through a debugger like Wing or Pycharm, I cannot get past the login page. After trying to login, it takes me back to the login screen again. When I look at the logs, it shows a 302 (redirect) in the debugger but normally it shows a 200 (OK). Could someone explain why this would be happening?
Thanks -Dimitry
Upvotes: 2
Views: 357
Reputation: 93
After a week of racking my brain, I finally figured out the problem. The gaesessions code was the culprit. We put DEFAULT_LIFETIME = datetime.timedelta(hours=1) and originally it was DEFAULT_LIFETIME = datetime.timedelta(days=7). Not sure why running it through any debugger such as wing or pycharm would prevent the browser from getting a session. The interesting thing is the code change with hours=1 works fine on linux with wing debugger. Very Strange!
Upvotes: 1
Reputation: 15143
This isn't really a great answer since I don't know much about Wing or Pycharm. But dev_appserver reroutes stdin and stdout to the WSGI handler. If you hit a breakpoint set by pdb.set_trace(), the breakpoint usually drops you to a shell that uses stdin/stdout, but with dev_appserver, you'll see the debugger shell piped to your HTTP, and there's no input available.
I'm not sure how Wing/Pycharm handle this. Pydev with eclipse works with dev_appserver, but that might be because of the GAE eclipse plugin.
I find myself often embedding breakpoints in my code and debugging manually at the shell, mostly because it runs way faster than in the pydev debugger. I do this be rerouting stdin/stdout back to the terminal when I hit a breakpoint. http://eatdev.tumblr.com/post/12076034867/using-pdb-on-app-engine
I'm on a linux environment. I did work with the GAE app launcher on Windows for a little bit, but not recently. I think I recall the app launcher hiding the original terminal that launches dev_appserver, so you might have to launch dev_appserver from the command prompt for this to work. I suspect you may need similar hacks if Wing or Pycharm use pdb underneath.
Upvotes: 1