Hundreds flocked to an October community meeting to vent their frustration with the district’s plan, and over 6,000 people have signed an online petition, started by Mr. Braley, against it. “Low-income housing doesn’t belong in Almaden,” one resident commented on the petition. “This would devalue home prices in the area significantly,” wrote another.

The school district, with 30,000 students, is losing one out of every seven teachers each spring. Some high-need students, like those with disabilities, are being taught by long-term substitutes or contractors. Like many other districts across the country with teacher shortages, it has begun recruiting educators from the developing world.

Starting salaries for teachers here range between $55,000 and $79,000. That kind of money does not go far in an area where the median home price is over $1 million, and the district cannot easily raise compensation to account for housing costs. Despite being one of the nation’s richest states, California’s education spending, about $11,000 per student, was slightly below the national average in 2016. Land is the most valuable asset the district has.

District-owned housing would have interested Jesse Escobar, 33, an academic counselor at a middle school in San Jose. He and his girlfriend, Shana Riehart, a high school teacher, were priced out of town and moved 25 miles away to Hayward, Calif. Ms. Riehart quit her job to take a position closer to their new home. Traffic means Mr. Escobar’s commute sometimes takes an hour and 45 minutes each way. He said it had been hurtful to hear parents oppose the housing plan for educators.

“Instead of saying teachers, if you had said engineers from Google or doctors from Kaiser, would the tone have been different?” Mr. Escobar asked. “Families trust us with their kids from 8 to 3 every day. I don’t know why it wouldn’t be the case that they would trust us in their communities.”