https://github.com/jakbin/flask-ngrokpy
Run flask with ngrok
https://github.com/jakbin/flask-ngrokpy
flask flask-example flask-ngrok ngrok port-forwarding python
Last synced: 8 months ago
JSON representation
Run flask with ngrok
- Host: GitHub
- URL: https://github.com/jakbin/flask-ngrokpy
- Owner: jakbin
- License: other
- Created: 2021-06-30T04:16:50.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-03T16:24:20.000Z (over 3 years ago)
- Last Synced: 2025-03-28T10:47:36.977Z (11 months ago)
- Topics: flask, flask-example, flask-ngrok, ngrok, port-forwarding, python
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flask-ngrokpy
[](https://colab.research.google.com/github/jakbin/flask-ngrokpy/blob/master/examples/flask_ngrok_example.ipynb)
[](https://badge.fury.io/py/flask-ngrokpy)
[](https://pepy.tech/project/flask-ngrokpy)
[](https://pepy.tech/project/flask-ngrokpy)

### This inspired from flask-ngrok
## Important :-
Some time, flask-ngrok need root or sudo permission. so , if you are a non-root user, you can't use it.
And flask-ngrok download ngrok in temp directory (/tmp in linux) so if you run it after shutdown or restart, its download ngrok every time.
**In flask-ngrokpy both problems are fixed.**
### Disclaimer:-
Use it only for educational purpose.
A simple way to demo Flask apps from your machine.
Makes your [Flask](http://flask.pocoo.org/) apps running on localhost available
over the internet via the excellent [ngrok](https://ngrok.com/) tool.
## Compatability
Python 3.6+ is required.
## Installation
```bash
pip install flask-ngrokpy
```
### Inside Jupyter / Colab Notebooks
Notebooks have [an issue](https://stackoverflow.com/questions/51180917/python-flask-unsupportedoperation-not-writable) with newer versions of Flask, so force an older version if working in these environments.
```bash
!pip install flask
```
See the [example notebook](https://colab.research.google.com/github/gstaff/flask-ngrokpy/blob/master/examples/flask_ngrok_example.ipynb) for a working example.
## Quickstart
1. Import with ```from flask_ngrokpy import run_with_ngrok```
2. Add `run_with_ngrok(app)` to make your Flask app available upon running
```python
# flask_ngrok_example.py
from flask import Flask
from flask_ngrokpy import run_with_ngrok
app = Flask(__name__)
run_with_ngrok(app) # Start ngrok when app is run
@app.route("/")
def hello():
return "Hello World!"
if __name__ == '__main__':
app.run()
```
Running the example:
```bash
python flask_ngrok_example.py
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Running on http://.ngrok.io
* Traffic stats available on http://127.0.0.1:4040
```