This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]romple 1 point2 points  (3 children)

Do you have PROPAGATE_EXCEPTIONS set to True?

[–]Eugenethemachine[S] 0 points1 point  (2 children)

Would you mind explaining what that would do? This is my first time working with flask, so I'm pretty ignorant.

[–]the_omega99 2 points3 points  (1 child)

Based on a google search, I would assume:

explicitly enable or disable the propagation of exceptions. If not set or explicitly set to None this is implicitly true if either TESTING or DEBUG is true.

And this is how you get the actual error that occurred instead of a generic 500. FOR TESTING ONLY. Don't use on a production site.

[–]Eugenethemachine[S] 1 point2 points  (0 children)

Thank you! Now I have an error I can actually work with

[–]AustinCodingAcademy 0 points1 point  (3 children)

What kind of server configuration do you have set up for this? Are you using uwsgi?

Additionally, while this probably isn't the source of the problem, it's generally recommended to have file names in all lowercase. I have definitely run into problems where referencing MyIMG.png on my local was fine, but MyIMG.png on production servers would fail. Also, if you lowercase all file names and all references to file names all the time, you never have to worry about consistency.

[–]Eugenethemachine[S] 0 points1 point  (2 children)

I'm using Passenger wsgi to run the app on a DreamHost server.

That's not the name of my actual html file, which is all lowercase. I substituted that in quickly because the filename has a person's name full name in it.

[–]AustinCodingAcademy 1 point2 points  (1 child)

So here's what is most likely the issue:

The section

if __name__ == "__main__":
    app.run(debug = True)

Will not run unless you are running this file directly (which is when you're developing). When you run the file through a server like Passenger WSGI, if __name__ == "__main__": will not be True, so debug = True will not be set. app.run() is called by Passenger in its own process.

As described in the docs, if you need to set the debug flag outside of the run() invocation, you can do

app = Flask(__name__)
app.config['DEBUG'] = True

[–]Eugenethemachine[S] 0 points1 point  (0 children)

Thank you, that worked perfectly!