| Article Index |
|---|
| 1. Start Python Web Server |
| 2. Request Data |
Python contains a number of web server related modules that provide the basic functionality to serve file system contents by default. So it is very easy to share contents underneath a directory path to all users that can connect your computer via LAN/network.
The following article describes a technique that is available in Python 3.x. For Python 2.x refer to article File Sharing with Python 2.x.
1. Start Python Web Server
To start the web server from command line simply key in the commands as follows:
# change to the directory that is to be shared $ cd path/mydir # start the web server at port 8000 $ python -m http.server 8000 #or... $ python3 -m http.server 8000
Hint: Please note that for compatibility reasons many Linux systems contain installations of Python v2.x and v3.x in parallel. in this case the older revisions are available by typing in 'python' and new releases are startable via 'python3' or 'python3.1'...
Attention: Be careful! All contents of the directory tree starting at the current directory will be available to everybody with access to your computer via network!
2. Request Data
Now you can access your directory contents with web browsers via the Url http://yourserver:8000/. (replace yourserver and 8000 with the ip address/hostname and port number to fit your needs)

Related articles:




