I picked this off of Barking Alien's commentary on someone else's seemingly endless "tips" for being a DM. It annoyed me enough to write on the subject as I considered it before.
I can take this two ways. The first is that town is safe. To which I reply.
There is no safe base. The city is just as much an encounter area as the dungeon. Players should never have the attitude of "well we're back in town nothing can touch us. That cult they stole from wants it's stuff back. The wizard is angry they broke his favorite stuff and ran off laughing. The lord of the knight they killed so casually, sends someone who seeks justice. If all else fails, that bling they've been flashing draws the carrion crows to them.
It's all temporary. As temporary as holing up behind that iron gate and locked door, so you can sleep and study like a mofo to get some spell points back. Hoping nothing can get through both, till the ooze shows up...
The second way I take this is, there is no level of safety in the dungeon.
Well I disagree on that. They might not be safe bases, but there are places of less danger. The consecrated shrine in the sea of undead. That locked room. The bedroom of the fearsome wizard, when he's not home. The rock spire surrounded by triceratops. I even knew one guy who invented the trick of stone shaping himself into a dead end. Then he'd pray and stone shape a way out in the morning. Rope Trick or similar spells. Any number of unique magic items. Are they still in some peril? Yet it isn't real peril. It's a variable.