Many times we want to share a movie, series, song, or document from our laptop or phone to another device without using the internet. Normally, people transfer through pen drives, cables, or third-party apps. But with Python, we can make a local server and share files instantly on Wi-Fi or hotspot.
The best part is:
- No need for internet
- No need for extra software
- You can even stream
.mp4
videos directly in the browser
Step 1: Using a Laptop or PC
1. Open Command Prompt or Terminal
Go to the folder you want to share.
cd "C:\Users\YourName\Videos\WebSeries"
For Linux/Mac:
cd ~/Videos/WebSeries
2. Find Your IP Address
Windows:
ipconfig
Check under Wi-Fi → IPv4 Address (example: 192.168.1.5
)
Linux/Mac:
ifconfig
or
ip addr show
3. Start the Python Local Server
python -m http.server 6789 --bind 0.0.0.0
6789
is the port (you can choose any free number above 1024 like 8000, 9090, etc.)--bind 0.0.0.0
makes your folder visible to all devices connected to the same Wi-Fi/hotspot
4. Open on Another Device
On another device connected to the same Wi-Fi/hotspot, open the browser and type:
http://YOUR_IPV4_ADDRESS:6789
Example:
http://192.168.1.5:6789
You will see all files inside that folder.
- Click a file to download it.
- If the file is a .mp4
video, you can play it directly.
Step 2: Using Mobile (Android with Termux)
1. Install Termux and Python
Download Termux from F-Droid. Then install Python:
pkg install python
2. Go to Your Folder
cd /sdcard/Download
3. Find Your Mobile IP
ifconfig
Look for something like inet 192.168.43.1
. That is your phone’s IP.
4. Start Python Local Server on Mobile
python -m http.server 6789 --bind 0.0.0.0
5. Open on Another Device
On laptop or another phone connected to the same hotspot/Wi-Fi, type:
http://PHONE_IP:6789
Example:
http://192.168.43.1:6789
Now you can download or play files directly from your phone.
Advantages of This Method
- Works offline with Wi-Fi or hotspot
- Files are visible in any browser
- Perfect for sharing large files like movies or songs
- One Python command setup
- Works on both laptop and mobile
With just a few commands, you can turn your laptop or phone into a local file server. This is especially useful when you want to quickly share media with friends or family on the same network. Once you try it, you’ll never need cables or third-party apps again.
Keywords
Python local server, Python file sharing, Python HTTP server, share files on Wi-Fi, share files on hotspot, Termux file sharing, stream videos on LAN, Python mobile server.
Frequently Asked Questions (FAQ)
Q1. Do I need internet for this method?
No, you only need Wi-Fi or a mobile hotspot. Internet is not required.
Q2. Can I use this to share very large files?
Yes, you can share large files like movies and videos as long as both devices stay connected to the same network.
Q3. Will it work between Windows and Android?
Yes. A file shared from Windows can be downloaded on Android, and vice versa.
Q4. Can I change the port number?
Yes, you can replace 6789
with any free port above 1024, such as 8080
or 9090
.
Q5. How do I stop the server?
Go back to the terminal or command prompt and press CTRL + C.