django-ssh-tunnel-proxy
Opens an ssh tunnel so your local development server can be accessed remotely
Quick start
- Install with
pip install django-ssh-tunnel-proxy - Add
sshtunnelproxytoINSTALLED_APPS - Set the settings described below
- Start a dev-server using
python manage.py runserver - Open a tunnel using
python manage.py opensshtunnelproxy - Visit the URL displayed in your terminal
Context manager
Create a temporary tunnel using the context manager
from sshtunnelproxy import tunnel
with tunnel() as remote_url:
pass # do something
Available settings
SSH_TUNNEL_USER: str = ''
"""The SSH user to use for the tunnel. default: `''`"""
SSH_TUNNEL_PASSWORD: str = ''
"""The SSH password to use for the tunnel. default: `''`"""
SSH_TUNNEL_PORT_RANGE: tuple[int, int] = (24000, 24999)
"""The range of ports to use for the tunnel. default: `(24000, 24999)`"""
SSH_TUNNEL_HOST: str = ''
"""The host to tunnel to. default: `''`"""
SSH_TUNNEL_URL_GENERATOR: Callable[[int], str] = lambda port: f"http://{SSH_TUNNEL_HOST}:{port + 1}"
"""
The function to generate the tunnel URL.
Takes the remote port as an argument and returns the URL at which the tunnel can be accessed.
default: `lambda port: f'http://{HOST}:{port + 1}'`
"""
Remote server
For this to work, you need a remote web server to reverse-proxy the tunneled port.
What else
Make sure to add SSH_TUNNEL_HOST to your ALLOWED_HOSTS.
Also, SESSION_COOKIE_SECURE = False must be set, or else you won't be able to log in.
Metadata
Release files for django-ssh-tunnel-proxy 1.0.4
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_ssh_tunnel_proxy-1.0.4.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_ssh_tunnel_proxy-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / django_ssh_tunnel_proxy-1.0.4.tar.gz
| Download URL | django_ssh_tunnel_proxy-1.0.4.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9801ade1cc4f5e5278d71b83592bce29e9371f8d94b0ccfae581f78ea7761114
|
|
BLAKE2b-256 checksum How to use checksums |
51f73fa5cdec221f2b929fd25e5c04d98b2dfad02f59b3850a0e4e37821cf223
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / django_ssh_tunnel_proxy-1.0.4-py3-none-any.whl
| Download URL | django_ssh_tunnel_proxy-1.0.4-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a57a1d10d9903add5f377ea64e7155418c74bfcb49478b03f004dbbe576d5818
|
|
BLAKE2b-256 checksum How to use checksums |
083825d99ca4dda547ef88e84418cfacc6d3b67679e2dbf968983591811e72c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|