A threaded HTTP/HTTPS server that exposes local Google Drive content as a JSON API for fast LAN-based file access in classrooms.
Classrooms need to access large presentation files (PPSX, PPTX, videos) from Google Drive. Downloading these files over the internet every time is slow and unreliable, especially with 30+ students accessing content simultaneously.
- Local caching: Google Drive syncs files to a local Windows machine at the school
- LAN server: This Python server exposes those files over the local network
- Fast access: Classroom tablets/laptops fetch files from the LAN server instead of the internet
Modern browsers enforce strict security policies. The main application runs on https://erp.walnutedu.in, and browsers block requests from HTTPS pages to:
- Plain HTTP servers (
http://192.168.1.100:8050) - blocked (mixed content) - IP addresses with self-signed certs - blocked (certificate errors)
- Create a subdomain in GoDaddy DNS:
shivanelocal.walnutedu.in - Point it to the LAN IP:
192.168.x.x(the local server's IP on the school network) - Get a real SSL certificate from Let's Encrypt for the subdomain
- Run the server with HTTPS using that certificate
This way:
- Browser sees a valid domain with a trusted SSL cert
- No mixed content warnings
- No certificate errors
- Works seamlessly from
https://erp.walnutedu.in
The server uses only Python standard library - no pip packages needed.
- Log into GoDaddy DNS management for
walnutedu.in - Add an A record:
- Name:
shivanelocal(orwakadlocal,fursungilocalfor other schools) - Type: A
- Value: The LAN IP of the server (e.g.,
192.168.1.100) - TTL: 1 hour
- Name:
Note: This DNS record points to a private/LAN IP address. It will only resolve correctly when accessed from within the school network.
Since the server is on a LAN IP (not publicly accessible), you must use DNS-01 challenge to verify domain ownership.
# Download and install Certbot from https://certbot.eff.org/
# Or use winget:
winget install EFF.Certbotcertbot certonly --manual --preferred-challenges dns -d shivanelocal.walnutedu.inCertbot will ask you to create a TXT record:
- Go to GoDaddy DNS
- Add a TXT record:
- Name:
_acme-challenge.shivanelocal - Type: TXT
- Value: (the value certbot provides)
- Name:
- Wait 1-2 minutes for DNS propagation
- Press Enter in certbot to continue
Certificates will be saved to:
C:\Certbot\live\shivanelocal.walnutedu.in\fullchain.pem
C:\Certbot\live\shivanelocal.walnutedu.in\privkey.pem
# Basic HTTP (not recommended for production)
python directory_server.py -p 8050 -d "G:\My Drive\Content"
# With HTTPS (recommended)
python directory_server.py -p 8050 -d "G:\My Drive\Content" --cert "C:\Certbot\live\shivanelocal.walnutedu.in\fullchain.pem" --key "C:\Certbot\live\shivanelocal.walnutedu.in\privkey.pem"To run the server automatically on startup, create a Windows Task Scheduler task or use NSSM (Non-Sucking Service Manager).
GET https://shivanelocal.walnutedu.in:8050/path/to/directory/
Returns JSON:
{
"directory": "/path/to/directory/",
"total_items": 5,
"generated_at": "2025-01-30T10:00:00",
"files": [
{
"name": "presentation.ppsx",
"extension": "ppsx",
"type": "file",
"size_bytes": 2299529,
"modified_timestamp": 1749023167.513,
"modified_iso": "2025-06-04T13:16:07",
"path": "/path/to/directory/presentation.ppsx"
}
]
}GET https://shivanelocal.walnutedu.in:8050/path/to/file.ppsx
Returns the file with appropriate MIME type and Content-Disposition headers.
Let's Encrypt certificates expire every 90 days. To renew:
certbot renewFor automatic renewal, add a Windows Task Scheduler task to run certbot renew daily.
The server uses ThreadingMixIn to handle multiple concurrent requests. Each incoming request spawns a new thread, allowing 100+ simultaneous connections.
- Ensure the server is running
- Check Windows Firewall allows the port (8050)
- Verify the DNS record points to the correct LAN IP
- Ensure you're using
--certand--keyflags - Verify certificate files exist and are readable
- Check certificate hasn't expired:
certbot certificates
- The server includes CORS headers by default
- If issues persist, check browser dev tools for specific error
- Ensure Google Drive is running and synced
- Check the
-ddirectory path is correct - Server waits for Google Drive process on startup (can skip with
--skip-drive-check)
MIT