Actually, the areas where it's easy to get weapons are sparsely populated rural areas in balochistan, kpk and sindh. By law it is very difficult to acquire weapons legally. All the higher calibers are prohibited (they require special licenses only politically very well connected people can get those). The low pistol etc calibers are available to public but not as simple as just going to a gun shop and buying.
Darra Adam Khel if I'm not wrong was shut down after taliban (TTP) took over that area. I've heard it's recovered since then (army clear up).
So in short, populated places where there are schools, people don't have easy access to weapons and schools always have armed security. And in places where weapons are easy to get, there are no schools, so.....
So the solution for USA is to put armed security in schools. But that costs lots of money in USA (min. wages too high etc). So the only reasonable thing to do is to let the good guys carry more guns. Then such incidents will get less common, because possible perpetrator will think twice before attacking already well armed citizens.
Alternatively, metal detectors in schools, that would also work.