7

I am running a code on a remote server that periodically generates a "status" html(something like a tensorboard say) and stores it in a folder in the server. Currently I download the html file whenever I want to check the status. If I can host the generated html using python into the server's localhost:p1, I can simply view the html in my local machine using

ssh -N -f -L localhost:p1:localhost:p1 servername

I know that people use xampp/wamp to put local html files in localhost. Is there a way to do this with python alone?

1 Answer 1

14

For Python 3, go to working directory where the files are located. Then run:

python3 -m http.server 8000

Now open a browser and navigate to localhost:8000.


For Python 2:

python -m SimpleHTTPServer 8000
Sign up to request clarification or add additional context in comments.

4 Comments

Yeah, that works. Anyway to download a whole folder when I have opened it using this method?
download by a click, or download by using a script?
Yeah, I want to download by click if possible. Else can I wget a folder?
yes you can, either wget, or requests library or urllib.. Try out some stuff yourself.;) The only way you will learn.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.