Closed Tejnium closed 5 months ago
There are a number of ways to do this, at least one is described in the docs using Cloud Edge.
from flask import Flask, request from pyngrok import ngrok, conf from pyngrok.conf import PyngrokConfig
conf.get_default().api_key = "
conf.get_default().config_path = "config.yml" app = Flask(name) conf.get_default().region = "au"
@app.route('/', methods=['GET', 'POST']) def home(): if request.method == 'POST': return 'POST request received!' else: return 'GET request received!'
if name == 'main':
public_url = ngrok.connect(name = "some-edge-tunnel")
print(f'Running server at {public_url}')
app.run(port=80)
i have run this
and this is my config.yml file
tunnels: some-edge-tunnel: labels:
what am i ding wrong?
Some tips for asking good questions:
ngrok
command that shows what you want to do / why it should work in pyngrok
, otherwise with so little other information, those trying to help you can't understand where you're trying to get to.
Acknowledgements
Describe the Feature
how to run flask from static url provided by ngrok for free? i always get CORS error when a random url is generated/
i am still not able to run it
!pip install Flask
!pip install pyngrok
!ngrok config add-authtoken xxxxxxxxxxxxxxxxxxxxxxxxx from flask import Flask, request from pyngrok import ngrok
app = Flask(name)
@app.route('/', methods=['GET', 'POST']) def home(): if request.method == 'POST': return 'POST request received!' else: return 'GET request received!'
if name == 'main':
Update the ngrok connect line with your custom domain
This is just for an example tp make sure instead of localhostL5000 the subdomain is started from the static url
Describe Alternative Solutions/Workarounds
i am suggesting if there is a way to get a free static url from ngrok which can help run the flask apploication and then use that same again and again .