Registry / web-framework / flask-cloudflared

flask-cloudflared

JSON →
library0.0.15pypypi✓ verified 84d ago

Flask-Cloudflared (current version 0.0.15) is a Python library designed to effortlessly start a TryCloudflare Tunnel directly from your Flask application. It simplifies exposing your local development server to the internet via Cloudflare Tunnels, making it ideal for webhook testing, demos, or sharing progress without complex port forwarding. The library is actively maintained, with new patch versions released as needed.

pip install flask-cloudflared
INSTALL
IMPORT
SIG · FLASK-CLOUDFLARED
F
flask-cloudflared
web-frameworkpythonv0.0.15
Install
3.1s avg
Import
Disk
25MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.15 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 26.4MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 3.1s · import 0.000s · 27MB
25MB installed
● package 25MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

run_with_cloudflared
from flask_cloudflared import run_with_cloudflared
from flask_cloudflared import run_cloudflared_tunnel
get_cloudflared_url
from flask_cloudflared import get_cloudflared_url
cleanup_cloudflared
from flask_cloudflared import cleanup_cloudflared

This quickstart demonstrates how to initialize a basic Flask application and start a Cloudflare Tunnel to expose it. The `run_cloudflared_tunnel` function handles the tunnel creation and outputs the public URL. Ensure Flask is running on the port specified for the tunnel.

import os from flask import Flask from flask_cloudflared import run_cloudflared_tunnel app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' if __name__ == '__main__': # Cloudflared will attempt to expose the specified port (default Flask port is 5000) # The tunnel runs in a separate process, allowing app.run() to proceed. tunnel_url = run_cloudflared_tunnel(port=5000) if tunnel_url: print(f"Cloudflare Tunnel is active at: {tunnel_url}") else: print("Failed to start Cloudflare Tunnel.") # Run the Flask application on the same port app.run(port=5000)
Debug
Known issues
gotchaThe `cloudflared` executable must be present and accessible in your system's PATH. Although `pip install cloudflared` helps, it doesn't always guarantee immediate accessibility in all environments, especially if relying on system-wide PATH configurations.
fix
Ensure the `cloudflared` Python package is installed (`pip install cloudflared`) and that the executable it provides is either in your system's PATH or directly callable. You can test by running `cloudflared --version` in your terminal.
affects: All versions
gotchaThe `run_cloudflared_tunnel` function is non-blocking, meaning it starts the tunnel in a separate subprocess. Ensure your Flask app starts *after* calling `run_cloudflared_tunnel` (as shown in quickstart) and on the same port, otherwise the tunnel might try to connect to a non-existent or wrong service.
fix
Call `run_cloudflared_tunnel()` before `app.run()`, and ensure both use the identical port number. The `port` argument in `run_cloudflared_tunnel` should match the port Flask is listening on.
affects: All versions
gotchaAs a 0.0.x version library, `flask-cloudflared`'s API is subject to change without strict adherence to semantic versioning. While stable for its current features, expect potential minor breaking changes in future `0.0.y` releases.
fix
Pin your dependency to an exact version (`flask-cloudflared==0.0.15`) in production. Regularly review the GitHub repository for release notes or breaking changes when upgrading.
affects: <1.0.0
Upgrade
Version history
0.0.15latest on PyPI · released Jan 27, 2026
Audit
Dependencies
FlaskrequiredCore web framework integration.
cloudflaredrequiredManages the Cloudflare Tunnel executable, providing a wrapper for its functionality.
Agent activity
4 hits · last 30 days
node
4
Resources
flask-cloudflared — pip install flask-cloudflared · libregistry