Advertisement
SH1NU11b1

Sharing a Directory Content over HTTP with Python

Sep 14th, 2015
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. It creates a Simple HTTP Server, that turns the current directory into your web server directory, that gives you an opportunity to share files from it over HTTP.
  2.  
  3. # For Python >=2.4
  4. python -m SimpleHTTPServer
  5. # For Python 3.x
  6. python -m http.server
  7.  
  8.  
  9. Now you can access the shared folder by visiting http://your_ip_address:8000.
  10.  
  11. By default Simple HTTP Server will listen to 0.0.0.0:8000, but port number can be changed :
  12. # For Python >=2.4
  13. python -m SimpleHTTPServer 8888
  14. # For Python 3.x
  15. python -m http.server 8888
  16.  
  17.  
  18. 0.0.0.0 - means that the server is not bound to a specific address, and will listen on all configured network interfaces.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement