You should probably try to figure out why it is crashing in the first place (:
That being said, if you run the app via docker, e.g. using gunicorn, you can set the restart option to “always”. Your app will then be restarted automatically if/when it crashes.