If you are using pork sausage or other meat, sauté it with a little olive oil until browned, in the same big heavy-bottomed deep skillet (or Dutch oven) you will use for the rest of this operation. Then set aside in a little bowl and wipe out the pan.
Preheat the oven to 425ºF. Add 2 tablespoons olive oil to the pan, heat it to medium, then add the shallots and carrots and sauté about 5 minutes. Add the garlic and cook another minute or so. Then add the tomato paste, anchovy paste and red pepper flakes (if you are using them), and stir and sauté everything another 2 minutes.
Add the spinach and continue to sauté until it wilts, stirring frequently, probably another 90 seconds. Then add the crushed tomatoes and 1/3 cup of the wine or stock. Mix everything together and bring to a simmer. If you are using meat, return it to the pan now.
Cook, occasionally stirring, for 10 – 12 minutes. You want the whole thing to reduce a bit and end up pretty thick, not liquidy—denser than the usual red sauce. Taste it. If it seems too acidic, add a bit of sugar. Add pepper now—you will add any salt later on. About five minutes in, add in the canned beans so everything can cook together for a bit. If the sauce is too thick and dry, you will know it—adjust with more wine or stock or even some water.
When the beany sauce is nicely thick, add salt, if you want, to taste. Turn off the heat. Sprinkle the mozzarella evenly all over the top, then do the same with the parmesan. Bake for 10 to 12 minutes—the photo above shows this very handsomely browned top after 12 minutes in our fast oven. This is ready to serve. Enjoy!