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-cloudflaredVerified import paths — ran on the pinned version, not inferred.
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.
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.
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.
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.