Adding middleware to avoid [Django] ERROR (EXTERNAL IP): Internal Server Error