When massive stars exhaust their fuel they collapse and often produce the extraordinarily bright explosions known as core-collapse supernovae. On occasion, this stellar collapse also powers an even more brilliant relativistic explosion known as a long-duration gamma-ray burst. One would then expect that long gamma-ray bursts and core-collapse supernovae should be found in similar galactic environments. Here we show that this expectation is wrong. We find that the long gamma-ray bursts are far more concentrated on the very brightest regions of their host galaxies than are the core-collapse supernovae. Furthermore, the host galaxies of the long gamma-ray bursts are significantly fainter and more irregular than the hosts of the core-collapse supernovae. Together these results suggest that long-duration gamma-ray bursts are associated with the most massive stars and may be restricted to galaxies of limited chemical evolution. Our results directly imply that long gamma-ray bursts are relatively rare in galaxies such as our own MilkyWay.