Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Ellen Shelton
Ellen Shelton
9,049 Points

Flask Basics (Forms) - pdb causing 502 Bad Gateway error

I'm working on the "Forms" portion of Flask Basics, and am running into a 502 Bad Gateway error when I try to save a name for the bear. This only happens after adding the line to import pdb and set trace. Once I delete the pdb line, I can save the name (redirect to 'index') without issue.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

Are you running locally or in Workspaces? If in Workspaces, can you provide a snapshot link to your code (including where you insert pdb.set_trace())? If local, can you paste your code into your post?

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

After playing with pdb in the workspaces environment I was able to reproduce the error.

502 Bad Gateway

The server returned an invalid or incomplete response.

This isn't an error, it is just the browser timing out while waiting for a response from the flask app. The app can not respond while it is stalled in the pdb debugger. This is a normal side effect of using the debugger (unless you're really fast and release the debugger quickly using 'c')

Ellen Shelton
Ellen Shelton
9,049 Points

Ah, thank you so much!

Ellen Shelton
Ellen Shelton
9,049 Points

Chris Freeman, thanks for replying! Screenshot here-- http://imgur.com/fbzgCWL

FWIW, I ran into this problem last week as well, so I tried everything anew today with the same result.