Adding faulthandler to template manage.py

(New here, so my apologies if this is in the wrong place).

I was curious if there has been any discussion on adding import faulthandler; faulthandler.enable() to the default manage.py generated by django setup.

faulthandler provides very useful information for tracking down weird bugs, and I end up adding it to most projects I work on long enough.

Since it doesn’t seem to be that well known, I was wondering if there would be appetite to change this in django itself.

Adding it to the template manage.py would mean it wouldn’t affect existing projects and would be easy to remove if it conflicted with custom signal handling that an application wanted to do.

I’m curious to hear some thoughts on this.

I think in most cases, it’s beyond Django to enable this everywhere. It may disrupt production processes, especially where a web server process has signal handlers or logs need to be output in a particular format like JSON.

Django’s test runner does enable faulthandler by default, since this ticket. pytest does this too. I think that’s about as far as a framework can safely go.

Adding it to manage.py would indeed allow users to disable it if needed, but it would also be more code and concepts to expose beginners too, plus there’s an ongoing discussion to make a django command that could supersede manage.py files.

Anyway, I’d like to see what someone else thinks too.