Skip to main content

Public url for your local web server.

Project description

=====
Django-Rok
=====

Django-rok is an ssh tunnel tool that provide a public url for your local web server and help in testing webhook integrations.
The django-rok is inspired from <a href="https://ngrok.com/" traget="_blank">ngrock</a> and built using <a href="http://www.paramiko.org/" targat="_blank">paramiko</a>.

# Installation

Install using `pip`...

pip install django-rok


# Quick Start
1. Add <b>"django_rok"</b> to your INSTALLED_APPS setting like this::
```python
INSTALLED_APPS = [
...
'django_rok',
]
```
2. Add the following parameters to the settings.py::
```python
ROK_REMOTE_HOST="192.168.1.1" # remote host ip
ROK_REMOTE_PORT=9000 # remote host port to connect to
ROK_USERNAME="root" # remote host username
ROK_PASSWORD="root" # remote host password
```

3. Instead of django runsver run this command::
```python
python manage.py runrok
```
This will run the rokserver as well as the django development server.


4. Now go to the url ```http://192.168.1.1:9000``` to access your local development server publicaly.


# Additional Configuration
1. Private key can be used to connect to the remote server. To do so add the following parameter to settings.py
```python
ROK_KEY="/path/to/private/key" # private key for remote host connection
ROK_PASSWORD=None # remote host password is not required since we are using private key
```

2. Rokserver can be started standalone without invoking the django development server. Thing can be achieved by setting env variable
```python
ROK_ENV="PRODUCTION"
```
3. Local port for rokserver can be changed by passing the ```-lp``` parameter
```
python manage.py runrok -lp 8080
```

# Command Line Usage
You can also pass the parameters through command line.

<b>Example:</b>
```
python manage.py runrok -r 192.168.1.1 -rp 9000 -u 'root' -p 'root'
```

To check the command line parameters run ```python manage.py runrok --help```

```
usage: manage.py runrok [-h] [--version] [-v {0,1,2,3}] [--settings SETTINGS]
[--pythonpath PYTHONPATH] [--traceback] [--no-color]
[-lp LOCAL_PORT] [-rp REMOTE_PORT] [-r REMOTE_HOST]
[-u USER_NAME] [-p PASSWORD] [-key PKEY] [-env ENV]

Command to run runrok server along with django development server

optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
-v {0,1,2,3}, --verbosity {0,1,2,3}
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
--settings SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Raise on CommandError exceptions
--no-color Don't colorize the command output.
-lp LOCAL_PORT The local port to forward the request.
-rp REMOTE_PORT The remote port for ssh connection.
-r REMOTE_HOST The remote host for ssh connection
-u USER_NAME The username for remote host
-p PASSWORD The password for remote host(If there)
-key PKEY The private key for remote host(If there)
-env ENV Which env the server is running on
```


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

django_rok-1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file django_rok-1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_rok-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf79680b6cb4812d45443295a5eaa34d3ac302e4ed6ff1e15028d6ea6e82fe47
MD5 1e0dfa5ecb199e1cd91930f57279a194
BLAKE2b-256 c29259f1636fbb3728fce0350796d0c8b6611c0a532ded437089903adb575660

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page