![]() ![]() If you don’t have python installed in your system and want to give it a try, please go through python tutorial for beginners to get started. That’s all about Python SimpleHTTPServer in python 2 and python http server in python 3. Python http server module doesn’t show all the python modules details on quitting from keyboard, that is a more clean approach. As you can see from terminal output that the python 3 http server module is more clean, provides clear messages. Browser output remains same as in above images. Python HTTP Serverīelow image shows the terminal output for python http server module in python 3. Note that if there is any index.html file then it will be served to the browser, otherwise directory listing will be shown as in above image. $python3 -m rver 9000īelow images show the Python SimpleHTTPServer output in terminal and browser. You can use below command to run python http server in Python 3. It’s because in python 3, SimpleHTTPServer has been merged into rver module. If you are running Python 3, you will get error as No module named SimpleHTTPServer. Python SimpleHTTPServer Error - No module named SimpleHTTPServer Yeah! You’re done!!! Now know your ip address and then replace localhost with your ip address and then share it with your friend. Then open your favourite browser and type localhost:9000. Try to use port number greater than 1024 to avoid conflicts. When a browser load livereload.js, it connects to the LiveReloadX server using WebSocket. You can run python http server on any port, default port is 8000. Type livereloadx path/to/dir on your command line, then LiveReloadX starts: watching path/to/dir running as a web server on port 35729 which serves livereload.js and acts as a WebSocket server. However, if you are using Ubuntu, just right click into that directory and open terminal. ![]() Just click on that and open command prompt there. Your will find option to open command prompt in that directory. If you are using Windows operating system then go to your desired folder or directory that you want to share. In this tutorial we will learn about basics of Python SimpleHTTPServer so that you can use it your day to day life. By Using SimpleHTTPServer, you can easily share your files to your friends who are in the same network. Then Python SimpleHTTPServer can help you in this case. But both of you have portable hard disks so that you can copy those movies to that portable hard disks and give it to your friend. You have some files that you want to share with your friend. Suppose you and your friend are using same local network. Python SimpleHTTPServer has been migrated to python rver module in python 3, we will learn about both of these modules today and see how easy it is to work with them. So it’s a good tool to share files over network. Python SimpleHTTPServer supports only two HTTP methods - GET and HEAD. You can use Python SimpleHTTPServer to turn any directory into a simple HTTP web server. Python SimpleHTTPServer module is a very handy tool. ![]()
0 Comments
Leave a Reply. |