Skip to main content

Using ngrok with Flask


tip

This article assumes you have Python, PIP, and Flask already installed.

To share a local Flask development server with someone else, simply run: ngrok http 5000.

Note: For users on the latest MacOS, there is an issue where the default port of 5000 is used by Apple AirPlay Receiver. You can use a different port for your Flask app or see this Stack Overflow post for disabling the AirPlay Receiver service.

Agent Management

If you're looking to natively embed the ngrok agent into your Flask development flow, you can leverage the pyngrok project so that a tunnel is created each time you type flask run.

Python SDK (beta)

You can also use the beta ngrok Python SDK to start a tunnel to the Flask dev server via python code, or using a ngrok ASGI runner with an ASGI Wrapper.