YES, you can! There are no dress codes in Oaxaca - come as you are! Shorts are pretty common to where since the days are hot. During the night, you might want to wear long pants though, especially in the months of November to February when evenings are chilly.