Expose your local Django app to the internet with ngrok
Project description
django-ngrok
Expose your local Django app to the internet with ngrok
Quick start
- Install with pip:
pip install django-ngrok
- Add django-ngrok to INSTALLED_APPS in your Django settings file:
INSTALLED_APPS = [
...
'django_ngrok',
]
- Set the
NGROK_AUTHTOKENenvironment variable to your ngrok authtoken:
export NGROK_AUTHTOKEN="your-ngrok-authtoken"
- Run
python manage.py runserver_ngrokto start a django development server and an ngrok tunnel pointing to the server address. You should expect to see the following output:
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
December 13, 2024 - 19:58:42
Django version X.Y.ZZ, using settings 'your.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
ngrok forwarding to http://127.0.0.1:8000 from ingress url: https://your-ngrok-domain.ngrok-free.app
Configuration
django-ngrok uses the forward method from ngrok-python to create a tunnel to the Django development server. If you are using a simple setup, no configuration is necessary, and you can get up-and-running by following the quick start.
For a more explicit setup, you can add the NGROK_CONFIG setting to your Django settings file. All options below are documented here. If you have any questions about how to use these options, please direct them to the ngrok-python maintainers.
NGROK_CONFIG = {
# session configuration
"authtoken": str,
"authtoken_from_env": True | False, # Defaults to True
"app_protocol": str,
"session_metadata": str,
# advanced session connection configuration
"server_addr": str,
"root_cas": str,
"session_ca_cert": str,
# listener configuration
"metadata": str,
"domain": str,
"schemes": list[str],
"proto": str,
"proxy_proto": str,
"labels": str,
# module configuration
"basic_auth": list[str],
"circuit_breaker":0.1,
"compression":True,
"allow_user_agent": str,
"deny_user_agent": str,
"allow_cidr": str,
"deny_cidr": str,
"crt": bytes, # I assume bytes, docs don't specify, haven't tested it.
"key": bytes,
"mutual_tls_cas": bytes,
"oauth_provider": str,
"oauth_allow_domains": list[str],
"oauth_allow_emails": list[str],
"oauth_scopes": list[str],
"oauth_client_id": str,
"oauth_client_secret": str,
"oidc_issuer_url": str,
"oidc_client_id": str,
"oidc_client_secret": str,
"oidc_allow_domains": list[str],
"oidc_allow_emails": list[str],
"oidc_scopes": list[str],
"policy": str,
"request_header_remove": str,
"response_header_remove": str,
"request_header_add": str,
"response_header_add": str,
"verify_upstream_tls": True | False,
"verify_webhook_provider": str,
"verify_webhook_secret": str,
"websocket_tcp_converter": True | False,
}
Contributing
Contributions and feedback are welcome! A contribution guide is upcoming, but if you have any questions, please feel free to open an issue or reach out directly.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_ngrok-0.1.0.tar.gz.
File metadata
- Download URL: django_ngrok-0.1.0.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.5.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02f7f87db8452c1a5646a413f0a9e032c0dd10cc9e6c4aff034a5c844eb558cf
|
|
| MD5 |
91e8efae5b68155d39bc700dae57d986
|
|
| BLAKE2b-256 |
4737a6c11d7b40c2f4c1d6513c53398782b89fb4f796d73be39d3ffc0b2b0e1b
|
File details
Details for the file django_ngrok-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_ngrok-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.5.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00d6b2ee34869f9cc2e5fc3d7accbc954845e7f3c6c62c543894ab17ad4f2c95
|
|
| MD5 |
63f5903c2241919b287c230952407754
|
|
| BLAKE2b-256 |
00f1dfd2125092133ef820253112aa84c47a0ab50aa3046caaf79c3c753c01eb
|