page_title: Shanghai
section_title: Imperial history
hierarchical_section_title: Shanghai / History / Imperial history
caption_attribution_description: 中文（简体）‎: 真如寺大殿 真如镇后山门5号 元延祐七年(1320年)
context_page_description: Shanghai is one of the four direct-administered municipalities of the People's Republic of China. It is under the direct administration of the State Council of China. The city is located on the southern estuary of the Yangtze, with the Huangpu River flowing through it. With a population of 24.28 million as of 2019, it is the most populous urban area in China and the second most populous city proper in the world. Shanghai is a global center for finance, technology, innovation, and transportation, and the Port of Shanghai is the world's busiest container port.
  Originally a fishing village and market town, Shanghai grew in importance in the 19th century due to trade and its favorable port location. The city was one of five treaty ports forced open to foreign trade after the First Opium War. The Shanghai International Settlement and the French Concession were subsequently established. The city then flourished, becoming a primary commercial and financial hub of the Asia-Pacific region in the 1930s. During the Second Sino-Japanese War, the city was the site of the major Battle of Shanghai.
context_section_description: During the Tang and Song dynasties, Qinglong Town (青龙镇) in modern Qingpu District was a major trading port. Established in 746 (the fifth year of the Tang Tianbao era), it developed into what historically called a "giant town of the Southeast", with thirteen temples and seven pagodas. Mi Fu, a scholar and artist of the Song dynasty, served as its mayor. The port experienced thriving trade with provinces along the Yangtze and the Chinese coast, as well as with foreign countries such as Japan and Silla.
  By the end of the Song dynasty, the center of trading had moved downstream of the Wusong River to Shanghai. It was upgraded in status from a village to a market town in 1074, and in 1172, a second sea wall was built to stabilize the ocean coastline, supplementing an earlier dike. From the Yuan dynasty in 1292 until Shanghai officially became a municipality in 1927, central Shanghai was administered as a county under Songjiang Prefecture, which had its seat in the present-day Songjiang District.
  Two important events helped promote Shanghai's developments in the Ming dynasty. A city wall was built for the first time in 1554 to protect the town from raids by Japanese pirates. It measured 10 m (33 ft) high and 5 km (3 mi) in circumference. A City God Temple was built in 1602 during the Wanli reign. This honor was usually reserved for prefectural capitals and not normally given to a mere county seat such as Shanghai. Scholars have theorized that this likely reflected the town's economic importance, as opposed to its low political status.
  During the Qing dynasty, Shanghai became one of the most important sea ports in the Yangtze Delta region as a result of two important central government policy changes: in 1684, the Kangxi Emperor reversed the Ming dynasty prohibition on oceangoing vessels—a ban that had been in force since 1525; and in 1732, the Qianlong Emperor moved the customs office for Jiangsu province (江海关; see Customs House, Shanghai) from the prefectural capital of Songjiang to Shanghai, and gave Shanghai exclusive control over customs collections for Jiangsu's foreign trade. As a result of these two critical decisions, Shanghai became the major trade port for all of the lower Yangtze region by 1735, despite still being at the lowest administrative level in the political hierarchy.
caption: The Mahavira Hall at Zhenru Temple, built in 1320
exif: {"Image ImageWidth": "4288", "Image ImageLength": "2848", "Image BitsPerSample": "[8, 8, 8]", "Image PhotometricInterpretation": "2", "Image Make": "NIKON CORPORATION", "Image Model": "NIKON D90", "Image Orientation": "Horizontal (normal)", "Image SamplesPerPixel": "3", "Image XResolution": "300", "Image YResolution": "300", "Image ResolutionUnit": "Pixels/Inch", "Image Software": "Adobe Photoshop CS6 (Windows)", "Image DateTime": "2016:02:24 20:19:33", "Image YCbCrPositioning": "Co-sited", "Image ExifOffset": "306", "GPS GPSVersionID": "[2, 2, 0, 0]", "Image GPSInfo": "1002", "Thumbnail Compression": "JPEG (old-style)", "Thumbnail XResolution": "72", "Thumbnail YResolution": "72", "Thumbnail ResolutionUnit": "Pixels/Inch", "Thumbnail JPEGInterchangeFormat": "1116", "Thumbnail JPEGInterchangeFormatLength": "7691", "EXIF ExposureTime": "1/320", "EXIF FNumber": "8", "EXIF ExposureProgram": "Manual", "EXIF ISOSpeedRatings": "200", "EXIF ExifVersion": "0221", "EXIF DateTimeOriginal": "2016:01:23 14:05:44", "EXIF DateTimeDigitized": "2016:01:23 14:05:44", "EXIF ComponentsConfiguration": "YCbCr", "EXIF CompressedBitsPerPixel": "4", "EXIF ShutterSpeedValue": "1040241/125000", "EXIF ApertureValue": "6", "EXIF ExposureBiasValue": "0", "EXIF MaxApertureValue": "4", "EXIF MeteringMode": "Pattern", "EXIF LightSource": "Fine weather", "EXIF Flash": "Flash did not fire", "EXIF FocalLength": "32", "EXIF SubSecTime": "00", "EXIF SubSecTimeOriginal": "00", "EXIF SubSecTimeDigitized": "00", "EXIF FlashPixVersion": "0100", "EXIF ColorSpace": "sRGB", "EXIF ExifImageWidth": "4288", "EXIF ExifImageLength": "2848", "Interoperability InteroperabilityIndex": "R98", "Interoperability InteroperabilityVersion": "[48, 49, 48, 48]", "EXIF InteroperabilityOffset": "952", "EXIF SensingMethod": "One-chip color area", "EXIF FileSource": "Digital Camera", "EXIF SceneType": "Directly Photographed", "EXIF CVAPattern": "[0, 2, 0, 2, 1, 2, 0, 1]", "EXIF CustomRendered": "Normal", "EXIF ExposureMode": "Manual Exposure", "EXIF WhiteBalance": "Manual", "EXIF DigitalZoomRatio": "1", "EXIF FocalLengthIn35mmFilm": "48", "EXIF SceneCaptureType": "Standard", "EXIF GainControl": "None", "EXIF Contrast": "Normal", "EXIF Saturation": "Normal", "EXIF Sharpness": "Normal", "EXIF SubjectDistanceRange": "0"}