python - Possible to run flask web app on linux server without web access and access through tunnel? -


i work on linux cluster behind firewall. not have web access.

i had idea try run flask , direct port know open (5901 vnc), , tunnel port , view in browser.

it's not working far. possible @ all?

here i'm doing:

helloflask.py

from flask import flask app = flask(__name__)  @app.route("/") def hello():     return "hello world!"      if __name__ == "__main__":         app.run(host='0.0.0.0', port=5901)         #app.run() 

i run python helloflask.py then

ssh -l 5901:<inner server>:5901 <outer server> 

then navigate localhost:5901. nothing. tried links localhost:5901 , links <server>:5901, again nothing.

is possible there way this?

you can : run flask app or notebook on remote server on port. example port 5000.

on local machine run below command establish ssh tunnelling :

ssh -d 8123 -f -c -q -n username@remotesrrver 

the port 8123 arbitrary here can allowed port on local machine. setup 1 of browser (fire fox may be) use socks proxy on port 8123 make sure traffic proxied localhost also. default firefox disable proxying localhost. once these established should able go http://localhost:5000 on browser hit app /notebook running on remote machine

and hellowflask.py should below work

from flask import flask app = flask(__name__)  @app.route("/") def hello():     return "hello world!"  if __name__ == "__main__":   app.run(host='0.0.0.0', port=5901)   #app.run() 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -