flask return 500 server error with mod_wsgi

1,530 views
Skip to first unread message

Cato Yeung

unread,
Sep 14, 2012, 3:49:33 AM9/14/12
to mod...@googlegroups.com
Dear Experts,
My flask application works well in development.
Now I want to put in production using mod_wsgi.
I found that simple template pages can be accessed but not the other ones using database.
However, with mod_wsgi, I can not read my log just like the console I used in development.
How can I read my log and solve the problem.
P.S. I have read my ssl error log and found nothing goes wrong.
Cheers,
Cato

Graham Dumpleton

unread,
Sep 15, 2012, 1:22:15 AM9/15/12
to mod...@googlegroups.com
Flask in a production setting, ie., not using its development server,
will turn exceptions into 500 error response pages and not log
anything. You will need to investigate how you set up Flask to log
such exceptions. If you set the 'debug' attribute of the Flask
application object:

app.debug = True

I believe it will renable the display of errors in the web page, but
you wouldn't want to use that on a customer facing site as they will
see the errors. So if you are the only user, use that, seeing Flask
documentation on exactly how to do it.

Perhaps also ask on #pocoo IRC channel for help on other options for
Flask or check StackOverflow.

Graham
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/v2QyJ7hG0jAJ.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to
> modwsgi+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.

Cato Yeung

unread,
Sep 18, 2012, 11:57:02 PM9/18/12
to mod...@googlegroups.com
I already add app.debug = True.
but it still shown the 500 error(none in development page).
I asked #pocoo irc channel and no one can answer that.

Cheers,
Cato

Graham Dumpleton

unread,
Sep 21, 2012, 2:49:24 AM9/21/12
to mod...@googlegroups.com
Have you read:

http://flask.pocoo.org/docs/errorhandling/#

and attempted to set up the application to log exceptions in any other way.

Also go read:

http://code.google.com/p/modwsgi/wiki/ApplicationIssues

and make sure your code isn't making assumptions such as what current
working directory is and not using absolute paths instead of relative
ones, plus making sure files are readable to user Apache runs as.

With an actual error traceback captured through Flask, it is going to
be hard to say.

Graham
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/YcYucdx3-osJ.
Reply all
Reply to author
Forward
0 new messages