Python flask

Hello everyone,

Does cloudflare workers support python web frameworks like flask, Django?
Is there any documentation available on how to deploy python web apps on cloudflare.


Welcome to the Cloudflare Community!

Unfortunately not. If it helps to understand the Worker model: Cloudflare manages the web server part and everything else, other then Javascript/WASM code you upload. Workers use V8 Isolates, which your code runs inside of. You are handed the incoming request, its headers/etc, and the body as a Stream: Request · Cloudflare Workers docs
Workers primarily are made in Javascript, but you can use WASM/WebAssembly as well, and there are libraries such as Workers-rs (GitHub - cloudflare/workers-rs: Write Cloudflare Workers in 100% Rust via WebAssembly), creating workers in Rust. But of course, even with WASM you can’t run web servers, you are just handed the request, so you have to make bindings around it.
How Workers works · Cloudflare Workers docs

Workers also have strict size limits (10 MB on paid) which basically prevents you from using a lot of languages, as their runtime alone would be larger then it.

There is a python example: GitHub - cloudflare/python-worker-hello-world: Python hello world for Cloudflare Workers, but it is accomplished by just transpiling the code into Javascript, and as per the reasons above, not possible to use any web server with it.

The upsides of this model is that Workers are everywhere, no cold starts, and inexpensive. If you have the time/it fits your other requirements, using/learning Javascript to use with Workers isn’t a bad idea. Workers are pretty close to normal web environment and web APIs.


Wow thank you @Chaika! Please hang out more in our Community (Workers thread) lol.

1 Like

Thank you for the valuable information @Chaika that helps

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.