Forums

502 Backend Error

hello, my deployed project is running, if there is an error in the code, django shows 502 error code instead of debug error, what is the reason? how can i solve it?

Take a look at the website's error log; there's a link to it on the "Web" page inside PythonAnywhere, and the most recent error message will be at the bottom of the file.

Error log is empty, i show this error if django return error, but i debug settings is true i'm not showing django error information Ex: Model.objects.get(name="sss") if object is not in db, 15 seconds after showing 502 error

I'm not sure exactly what do you want to achieve -- if you're chaning the settings, you need to reload the web app afterwards. If error log is not showing anything, check the server log as well.

Hi, my problem is exactly this; i restart my server and if there is a wrong line of code normally django will explicitly state it but now if there is an error in the line of code I wait for close to 20 seconds and then I get 502 error

Certain problems in web app code will generate error output, but others cause the 502 error. In general, the ones that cause 502s are not producing an error, they are just causing the request to take too long or are causing the entire web app to crash in some way, so an error message cannot be generated. See https://help.pythonanywhere.com/pages/502BadGateway/ for details on how to debug 502 errorrs.