📡 django-netcast
Instantly share your Django dev server with any device on your Wi-Fi — zero configuration required.
No more editing ALLOWED_HOSTS. No more Googling "what's my IP". No more 0.0.0.0 confusion.
Just run one command and open the URL on your phone.
python manage.py share_local
┌──────────────────────────────────────────────────────┐
│ django-netcast · LAN server running │
├──────────────────────────────────────────────────────┤
│ Local: http://127.0.0.1:8000/ │
│ Network: http://182.178.1.42:8000/ │
├──────────────────────────────────────────────────────┤
│ ⚠ Anyone on your Wi-Fi can access this! │
└──────────────────────────────────────────────────────┘
Features
| Feature | Details |
|---|---|
| Zero config | No changes to settings.py needed |
| LAN IP auto-detection | Uses the OS routing table — works on macOS, Linux & Windows |
| ALLOWED_HOSTS injection | Automatically adds the LAN IP at runtime |
| CSRF_TRUSTED_ORIGINS | Adds the correct http:// origin so Django admin & POST forms work from mobile |
| Static files | Inherits from staticfiles runserver — your CSS/JS just works |
| Auto-reload | Subclasses Django's runserver — file watching & auto-restart included |
| Offline-safe | Gracefully falls back to 127.0.0.1 when no network is found |
| No dependencies | Only uses the Python standard library + Django itself |
Installation
pip install django-netcast
Then add it to your INSTALLED_APPS:
# settings.py
INSTALLED_APPS = [
# ...
"netcast",
]
That's it. No middleware, no URLs, no database migrations.
Usage
Basic (default port 8000)
python manage.py share_local
Custom port
python manage.py share_local 9000
All standard runserver flags work
python manage.py share_local --noreload --nothreading
How It Works
- Resolves your LAN IP — Opens a dummy UDP socket to
8.8.8.8(no data is sent) and reads which local interface the OS would route through. - Patches
ALLOWED_HOSTS— Adds0.0.0.0,127.0.0.1,localhost, and your LAN IP in-memory so Django doesn't reject the request. - Patches
CSRF_TRUSTED_ORIGINS— Addshttp://<LAN-IP>:<PORT>so POST requests (forms, admin login) work from other devices without CSRF errors. - Binds to
0.0.0.0— Tells the server to listen on all network interfaces instead of just localhost. - Prints a clean banner — Shows clickable local and network URLs, plus a security reminder.
Note: All changes are in-memory only — your
settings.pyfile is never modified.
Security
This tool is designed exclusively for local development.
- It binds your server to all network interfaces (
0.0.0.0). - Anyone connected to the same Wi-Fi network can access your dev server.
- Never use this in production. Use a proper WSGI/ASGI server behind a reverse proxy instead.
FAQ
Does this modify my settings.py?
No. All changes happen in-memory at runtime. Your files are completely untouched.
Does it work offline?
Yes. When no network is detected, it falls back to 127.0.0.1 and works like the normal runserver.
Can I use this with Docker?
It's designed for bare-metal local development. Inside Docker, network exposure is typically handled by port mapping (-p 8000:8000).
Does auto-reload still work?
Yes. share_local subclasses Django's own runserver, so file watching, auto-restart, and threading all behave exactly the same.
Does it serve static files?
Yes. It inherits from the staticfiles variant of runserver, so {% static %} tags work out of the box during development.
Compatibility
| Supported | |
|---|---|
| Python | 3.9, 3.10, 3.11, 3.12, 3.13 |
| Django | 4.2, 5.0, 5.1+ |
| OS | macOS, Linux, Windows |
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
# Clone the repo
git clone https://github.com/sagar9187/django-netcast.git
cd django-netcast
# Install in editable mode with test dependencies
pip install -e ".[dev]"
# Run tests
pytest
License
MIT — see LICENSE for details.
Built with ❤️ for developers who test on their phones.
Metadata
Release files for django-netcast 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_netcast-0.1.1.tar.gz | 8.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_netcast-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.4 kB
Release files / django_netcast-0.1.1.tar.gz
| Download URL | django_netcast-0.1.1.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e70d5be9bb7e12ba0360452c887d2f7ed59f999489a416c0054663e14f42b92
|
|
BLAKE2b-256 checksum How to use checksums |
f2fbc572d3f1b33f581c1717e3b7ed59f9001744003ade8b480c950124635301
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / django_netcast-0.1.1-py3-none-any.whl
| Download URL | django_netcast-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2149b5568873638ec6d01f3197bce7390744fe33eff64d082075cdefc3c72352
|
|
BLAKE2b-256 checksum How to use checksums |
9a2a9a3eccf1bd90bda04fec3965bce43218129c9867276345a192ededb84acb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|