The ninth-grade student was detained immediately after the shooting at Lakanal middle school in Aubagne, near Marseille, Mayor Jean-Pierre Squillari said. French media reported the suspect was 14.
The pupil is said to have entered the school with a gun before several shots were heard, and was then restrained by a member of staff. The headteacher, 53, was reportedly shot in the leg, while a 37-year-old teacher was hit in the thigh.
"All students were immediately confined and made safe within seconds," Squillari said in a social media update.
Education Minister Edouard Geffray wrote on social media that two staff members, "a principal and a teacher, were victims this morning of gunshot wounds at Lakanal middle school in Aubagne," and that a student is said to be the perpetrator. He is due to visit the scene on Monday afternoon with Interior Minister Laurent Nuñez.
Broadcaster BFMTV and Le Parisien reported that the incident was not thought to be related to ongoing protests over school conditions, citing sources familiar with the investigation.