Django-Rok : Public URL for your local web server

Ankur Jain
2 min readJul 28, 2018

--

The django-rok is an reverse-ssh tunneling tool provides a public URL for your local web server. This is helpful in web-hook testing, quick UAT and many more.

To set up a SSH tunnel a given port of one machine needs to be forwarded to a port in the other machine which will be the other end of the tunnel. Once the SSH tunnel has been established, the user can connect to earlier specified port at first machine to access the network service.

# Setting Up

Let’s begin by setting up django_rok

1. Install djanog_rok using pip.

$ pip install django_rok
or
pip3 install django_rok

2. Add django_rok to installed app

3. Add following parameters to the settings.py file

4. Enable Remote Port forwarding on the server. This can be achieved by editing /etc/ssh/sshd_config .

$ sudo vim /etc/ssh/sshd_config

Add the following line somewhere in that config file. Make sure you add it only once!

GatewayPorts yes

Now restart the service

$ sudo service ssh restart

# Running

The django_rok can be run by the following command

$ python manage.py runrok

This starts the django server as well as the reverse ssh tunnel

Now go to http://192.168.1.1:9000 to access your local code on a public URL.

--

--