I am currently developing an application based on flask
. It runs fine spawning the server manually using app.run()
. I've tried to run it through mod_wsgi
now. Strangely, I get a 500 error, and nothing in the logs. I've investigated a bit and here are my findings.
- Inserting a line like
print >>sys.stderr, "hello"
works as expected. The message shows up in the error log. - When calling a method without using a template it works just fine. No 500 Error.
- Using a simple template works fine too.
- BUT as soon as I trigger a database access inside the template (for example looping over a query) I get the error.
My gut tells me that it's SQLAlchemy which emits an error, and maybe some logging config causes the log to be discarded at some point in the application.
Additionally, for testing, I am using SQLite. This, as far as I can recall, can only be accessed from one thread. So if mod_wsgi
spawns more threads, it may break the app.
I am a bit at a loss, because it only breaks running behind mod_wsgi
, which also seems to swallow my errors. What can I do to make the errors bubble up into the apache error_log?
For reference, the code can be seen on this github permalink.