Ratatouille can take many forms.

There's fancy: eggplant, tomatoes and zucchini artfully cut and arranged in a dish before baking — the kind of thing you don't mind getting the china down for. And there's simple: a potentially sloppy mix of long-stewed vegetables, liable to collapse in an oily heap on your everyday plates before being devoured.

The same can be said for ratatouille baked in a crust. It can be an elegant tart, a dainty quiche or, as in this case, a rustic pie that's homely, but impossible to resist. Its golden crust shatters messily when you cut it. The custard filling could leak, escaping the pastry. The cheese may brown; the tomatoes on top may shrivel.

None of that matters when you taste it, each buttery, creamy, vegetable-filled bite flavored with herbs and olives, and covered in cheese.

This recipe is very loosely based on a Southern tomato pie. There's a parbaked pie crust anchoring the vegetables, and a custard imbued with mayonnaise and cheese to bind them. But that's where the similarities end.

Here, I skipped the raw tomatoes, substituting a mix of summer vegetables cooked in plenty of olive oil until velvety soft. I particularly like to roast them so they caramelize and release much of their moisture, which keeps the pastry from turning soggy. If you have leftover ratatouille or any kind of cooked vegetables — roasted, grilled, sautéed — in your fridge, you could use those instead. You'll need about three to four cups of cooked vegetables, enough to fill the crust by two-thirds.

If you are using your own cooked vegetables instead of roasting them as in the recipe, be sure to stir in plenty of herbs: basil, rosemary and thyme. These add a lot in terms of complexity, and keep the olives from taking over.

Now, about the mayonnaise. While it may seem like an odd match with ratatouille, it has an inherent tanginess that works well with the richness of the vegetables. I did try baking a version using crème fraîche to make it a little more French-seeming. But, to me, the result was insipid. Purists can make their own mayonnaise if anyone objects to using the stuff from the jar.

No matter how else you tweak it, make sure to bake the pie on the day of serving. This hot mess is its best, stunning self when it's just that: just baked, a little warm from the oven and delightfully gooey.