The Rurality Index is an important reference for the formulation of rural development strategies and policies, but the evaluation of the rurality of megacities based on the township scale is relatively limited. Based on the perspective of spatial governance, this study constructed the evaluation index system of Shanghai’s rurality and carried out the evaluation of Shanghai’s rurality at the township scale from 2005 to 2020. The article adopts the MGWR model to analyze the driving effects of five key driving factors (the proportion of foreign population, per capita industrial output value, public finance revenue, social fixed asset investment, and rail transit coverage), and adopts the Geo-Detector model to analyze the interactive driving effects of two factors. The results indicate that the rurality index of megacities and townships as a whole shows a weakening trend, and the above factors have a predominantly negative impact on rurality, with differences in the intensity of the impact in different periods. There is an obvious interactive additive effect between the factors. When formulating policies for township development, government departments need to take into account the functional positioning of the region and comprehensively adopt targeted policies on population, industry, transportation, finance and investment to regulate and guide the transformation or sustainable development of the countryside.