Does Django Work in China? Data Residency, ICP & Cross-Border Rules
Django is open-source Python code you run on your own servers, so it is residency-neutral — it runs the same in Beijing or Frankfurt. The China question is where you deploy it and where its database lives: a mainland-facing app owes ICP and MLPS, and the personal data in its database and admin falls under PIPL.
Does Django work in China?
Django is open-source Python code you run on your own servers, so the framework itself has no China residency problem — it runs the same in a Beijing data centre as in a Frankfurt one. "Does Django work in China?" is really a deployment-and-data question: where the app runs, and where its database lives.
Point Django at a mainland audience and the host owes an ICP filing (备案) and MLPS (等级保护) as the operator. The personal information in the app's database and its built-in admin is governed by PIPL; an offshore database makes China users' data a cross-border transfer (Articles 38–40: notice, a separate consent, and a transfer mechanism), and a critical information infrastructure operator or large-volume handler must keep it in the mainland (Cybersecurity Law Article 39 (formerly Article 37)). Package pulls from PyPI and crash telemetry route offshore by default.
21YunBox stands up an ICP-filed, MLPS-appropriate in-country footing with your China data resident, and delivers the China-facing surface in front of your existing Django app — no rebuild, and never through circumvention. Treat the specifics as a risk to confirm with counsel.
What Django's own documentation says about China
| Fact | Primary source |
|---|---|
| Django is open-source code you run yourself. Django's site calls it “a high-level Python web framework that encourages rapid development” and states plainly, “It's free and open source.” There is no hosted Django service and no in-country region to choose — it runs wherever you deploy it, mainland included. | Django Software Foundation — djangoproject.com homepage (“Meet Django”), retrieved 2026-10-14 |
| You choose the database and where it runs — Django does not. Django's documentation says it “officially supports the following databases: PostgreSQL, MariaDB, MySQL, Oracle, SQLite.” The ORM shapes your data model; the database engine, and the server it sits on, are your deployment choices — which is where residency is actually decided. | Django documentation, “Databases” (docs.djangoproject.com), retrieved 2026-10-14 |
| A mainland-facing deployment owes an ICP filing and MLPS. Any app serving users in the mainland must run on a hosting resource with an ICP filing (备案), and the system carries MLPS (等级保护) obligations as the operator — duties that attach to your deployment, not to the Django framework. | 21YunBox — How to get an ICP filing for China (备案), retrieved 2026-10-14 |
| China users' personal data sent offshore is a cross-border transfer. Under PIPL (Articles 38–40), a Django app writing mainland users' personal information to an offshore database needs notice, a separate consent, and a transfer mechanism; a critical information infrastructure operator or large-volume handler must keep that data in the mainland (Cybersecurity Law Article 39 (formerly Article 37)). | 21YunBox — Cross-border data transfers under PIPL (Articles 38–40), retrieved 2026-10-14 |
Sources verified by the 21YunBox compliance team on 2026-10-14.
For a mainland-China audience, the first thing to settle about Django is that the question is not whether it loads, and not really about Django at all. Django is an open-source Python web framework — you install it from a package index and run it inside your own application, on whatever server you deploy to. By itself it is residency-neutral code: it holds no data of its own and phones nothing home. It runs identically in a Beijing data centre and a Frankfurt one. So “does Django work in China” resolves into a different question — a deployment-and-data one: where does the app run, where does its database live, and does the personal information it collects from China users cross the border to reach infrastructure that sits abroad? That border crossing is the compliance event — not the round-trip time, and not the framework.
Django in China at a glance
| What decides it | In Django's own terms — and China's law |
|---|---|
| Where the app actually runs | Django is open-source code you deploy on your own server; there is no hosted Django "service" with a region to select, so the framework itself is residency-neutral and runs in-country just fine. What is not neutral is the host you deploy to: an app serving mainland users should sit on a hosting resource with an ICP filing (备案), and the system carries MLPS (等级保护) duties as the operator. |
| The database you wire it to | Django's documentation says it "officially supports the following databases: PostgreSQL, MariaDB, MySQL, Oracle, SQLite." The ORM and your models shape the data; the database engine, and the server it sits on, are deployment choices you make — which is exactly where residency is decided, not by Django. |
| The personal data it holds | Django is "batteries-included": it ships a user-authentication system and a built-in admin site, so by default the app stores user accounts, hashed passwords, sessions, and whatever your models collect. That is personal information under PIPL — and sensitive personal information under Article 28 where government IDs, financial, or health data appear. The admin console is a direct window onto all of it. |
| Data crossing the border to an offshore database | When a mainland user's personal information is written to a database hosted abroad, that is a cross-border transfer under PIPL (Articles 38–40): notice, a separate consent, and one transfer mechanism — a CAC security assessment, the CAC standard contract, or certification. A critical information infrastructure operator or large-volume handler must store China personal information in the mainland (Cybersecurity Law Article 39 (formerly Article 37)). |
| Outbound dependencies | Django and its packages install from PyPI with pip, and a mainland build that resolves requirements.txt reaches that index offshore by default. Crash and performance telemetry, and any third-party APIs the app calls at run time, can route abroad too — a supply-chain and residency concern that rides along with the runtime. |
| Reachability is not the axis | That pip install succeeds and the page renders tells you nothing about whether the deployment and its data were allowed to sit where they sit. The decision turns on residency — where the app and its database come to rest, and on what legal basis the personal data moves. This page publishes no first-party latency figure; speed is the wrong axis. |
The framework runs where you run it — so the deployment decides residency
Start with where Django runs, because the whole question rests on it. Django is a framework you add to your own codebase: its homepage calls it “a high-level Python web framework that encourages rapid development,” and notes that “It’s free and open source.” There is no hosted Django to connect to and no in-country region to select — the framework executes inside whatever application you deploy, which can just as easily sit on a mainland server as anywhere else. In that sense Django is reachable and usable from China in a way a blocked consumer service is not, and it can run entirely in-country.
What that also means is that Django never sets your residency posture — your deployment does. Two choices carry the weight. The first is the host. An app that serves users in the mainland should run on a hosting resource that carries an ICP filing (备案), and the system owes MLPS (等级保护) obligations as the operator of an in-country information system. An offshore virtual machine that mainland users hit is the real exposure — and that is a deployment decision, not a property of Django. The second choice is the database, which is where the data actually lives.
The database and the admin hold the personal data
A Django request is not neutral text, because Django is “batteries-included” by design. Out of the box it ships a user-authentication system and a built-in administrative interface, so the moment you stand an app up it is storing user accounts, hashed passwords, session records, and whatever fields your models define. Django’s own documentation is explicit that it “officially supports the following databases: PostgreSQL, MariaDB, MySQL, Oracle, SQLite” — the ORM gives you a database-agnostic way to describe your data, but you choose the engine and, crucially, the server it runs on. The framework shapes the data; it does not decide where the data lives.
That matters because the database and the Django admin are where the personal information concentrates. The admin site at the app’s admin URL is a direct console onto every record — user accounts, contact details, orders, whatever the models hold. The moment a user in China submits personal information and your app writes it to a database hosted outside the mainland, that write is a cross-border transfer under China’s Personal Information Protection Law. PIPL puts the duty on the handler — you: Articles 38–40 require notice, a separate consent, and one transfer mechanism (a CAC security assessment, the CAC standard contract, or certification), and Article 28 adds heightened duties where the data is sensitive — government IDs, financial, health, biometric, or minors’ information. And if your organization operates critical information infrastructure, or handles personal information at scale, the Cybersecurity Law adds a data-localization duty — Article 39 (formerly Article 37; renumbered by the 2025 amendment in force January 1, 2026, substance unchanged) requires personal information collected and generated in-country by such operators to be stored in-country, with a security assessment before any export.
Dependencies and telemetry reach offshore by default
There is a third strand that a framework page should name plainly. A Django deployment is not just your code — it is your code plus a tree of third-party packages, resolved from PyPI by pip when you build. A build or deployment pipeline running in the mainland reaches that index offshore on every resolve, so your supply chain crosses the border as a matter of routine, and a private package that embeds credentials or tokens crosses with it. On top of that, the crash-reporting and performance-telemetry agents commonly wired into a Django app, and any third-party APIs the app calls at run time, send their payloads to wherever those services are hosted — frequently abroad. None of this is a reason not to use Django; it is simply a second surface, beyond the user database, where data and dependencies leave the country unless you deliberately keep the pipeline and those calls in-country.
Why a reachability check misses this
A reachability or latency test pings an endpoint and reports whether it answers and how fast. For Django that test answers the wrong question. First, there is no “Django endpoint” to ping — the framework runs inside your app, so a green light on pip install or a fast-rendering page tells you nothing about where the app and its database end up. Second, what actually decides compliance is invisible to a probe: whether the host carries an ICP filing and meets its MLPS duties, whether the database sits in the mainland, whether the personal information crossing to it is sensitive or “important data,” and whether your dependency pulls and telemetry route abroad. Those are deployment and legal facts, not network facts. That is the half a pure speed-or-reachability view cannot supply — and the half we lead with.
The lawful path — map, localize, deliver
For an open-source framework, 21YunBox’s role is focused, and we will say so plainly: there is no “domestic Django” to sell you — the framework is already yours to run, including in-country. Our value is in three moves.
First, we map the exposure: where your Django app is actually deployed, where its database lives, what personal information its models and admin hold (and whether any of it is sensitive or “important data”), and which dependency pulls, telemetry agents, and third-party APIs route offshore — all of it set against the ICP/MLPS duties on the host and PIPL’s cross-border rules, Article 28, and the Cybersecurity Law, so you and your counsel can set the guardrails. Second, we help you localize what cannot lawfully sit abroad: run the Django app in-country on ICP-filed, MLPS-appropriate infrastructure, keep China users’ personal information in a mainland-resident database, and resolve dependencies from an in-country index rather than reaching offshore on every build. This is a China-legal footing, never a route around the rules. Third, we deliver your China-facing surface — the app and API edge your mainland users hit — over ICP-filed, in-country infrastructure (the 21YunBox Optimizer), in front of the stack you already run, with no rebuild and no second codebase.
21YunBox is a compliant overlay, not a migration, and a partner to the tools you use, not a competitor to them. 21YunBox never uses or suggests circumvention of any kind. The result is a setup that runs legally and compliantly for your users in China.
Related reading:
- How to get an ICP filing for China
- Cross-border data transfers under PIPL
- China’s Personal Information Protection Law
- China’s Cybersecurity Law (data localization, Article 39)
