I get strange errors when trying to deploy a Flask app (v0.8). I’m using apache’s mod_wsgi, as suggested in the docs (almost to the letter). What’s strange is that on some requests (simply accessing / via browser), the application loads fine, but very often I get a resource load errors (can’t fetch some css or image), and the error log shows something like Premature end of script headers: myapp.wsgi. Sometimes apache crashes with Internal Server Error. I’m trying to chase the problem but could not figure out what’s the cause. My wsgi file looks simple:
from myapp import app as application
Any clues where to start looking?
If you are getting Premature end of script headers, you are using daemon mode and the daemon process is crashing with a seg fault or similar.
Make sure you aren’t still loading mod_python.
Also try setting:
to work around issues with Python C extension modules which aren’t safe for sub interpreters.
See:
http://code.google.com/p/modwsgi/wiki/ApplicationIssues
and look for various reasons for crashes listed.