Forums

Error 500 using Flask in pythonanywhere

Hi, sorry for my strange English, I currently use Google Translate.

I've been having a problem for a few hours, my flask app has always worked using the classic app.run() without specifying the port and host. I had added a small script of Javascript code via Jquery in the templates/file.html file, then I removed this piece of code.

Now the problem is that if I am currently on the index page the site is shown without problems, while if I go to the Login page and click on "LOGIN" it gives me the 500 error, checking app.py in bash tells me that the port 5000 is occupied by another program, how is this possible?

As I already said above, the app worked without problems a few hours ago and worked for about 1 month without ever having any interruptions. Any help from you will be truly appreciated.

app.run() does not work on PythonAnywhere so you must have been misunderstanding how was it running. See https://help.pythonanywhere.com/pages/Flask#do-not-use-apprun

Thanks for the quick reply, I solved it, the problem was an oversight on my part, the if main was missing. Thanks again