I lived in New Orleans and would commute through the more sketchy parts of town in the early morning. Early, as in too early for most trouble makers to be awake. Then, scenic (longer, safer) route on the way home in the evening.
Riding fast helps too.