Django with NGROK

Testing our Django App to be publicly accessible using NGROK

Today(November 29, 2019) I am approaching to carry out my Django project, the progress is about 70% now, so I am curious how does my project look like when deploying to public, instead of only viewing on my localhost machine. And I also want to test how different is it between desktop and mobile screen. On desktop, it looks pretty good as I expect, but mobile screen is not quite sure) So I should find out which solution is best fit what I am looking for. Of course, I am not ready to deploy it now, just want to test my progress, and maybe, to show my friends a simple website to get some feedback from them or others as well.

First, I tried to google, and found a few ways to do, but the most recommended and easiest solution is the keyword following … “NGROK”

So let’s get dive into NGROK now.

1 . Download NGROK from its Official Website(ngrok.com)

Search for “NGROK” then clcik “Download”

2. Click to download.

Download NGROK.

3. Unzip the file you have downloaded.

After unzipping the file you will see an executable file called “ngrok.exe” Click it!

Double click on ngrok.exe file.

4. You will see NGROK terminal.

Then you can add the following command “ngrok.exe http 8000” (I use port 8000 for my localhost port, and many Django projects would use the port 8000 as well) after the directory “C:\Users\User\” so the final path will look like the path below.

C:\Users\User\ngrok.exe http 8000.

Type and run command “ngrok.exe http 8000”

You can use “afa61242.ngrok.io” this means your temporary domain name(In your case, you will get another different name e.g. “chk1286.ngrok.io”)

You will get this key(Temporary Domain)

5. Go to settings.py

Add ‘127.0.0.1’, ‘localhost’, ‘afa61242’ into the list of ALLOWED_HOSTS

Add the key that NGROK randomly provides you.

6. Run command → “python manage.py runserver”

Now you will see the URL 127.0.0.1.8000 or localhost as regularly as you see when running a server on your local machine.

On your localhost

Job done !!

Now, everything is done, after running the server, you already have your own temporary website to share to public or get benefits from it or whatever you want.

You can send this link to people, so that they can see your site publicly

Don’t wait !! just show it to the world, how nice your site is.

When your friends or people get a link you send, they will see your website publicly.

Note. The session remains for 8 hours, after that, it will expire, and you would reset the server again.

You already have your own temporary public site now.
You will get noticed when people are accessing your site.

If my article is helpful, please clap to support me continuing my good work, and do not hesitate to drop your comment below sharing me your opinion. See you again next article.

Sonny STACKPYTHON

Instagram: stackpython

Facebook: stackpython

Website: stackpython.co

YouTube: stackpython

--

--

--

Full Stack Python Developers

Love podcasts or audiobooks? Learn on the go with our new app.

Heroku Migration Failures: pg_try_advisory_lock, no happy endings.

Life of a Packet in Kubernetes — Part 4

Build A Virtual Assistant Using Python

Rotating Docker Logs — Keeping your overlay folder small

KOTLIN HATCHING : KOT 101, Introductory Tutorial

35+ stl Decorative Square flower 3D model for 4 axis circular diagram 3D — Download

35+ stl Decorative Square flower 3D model for 4 axis circular diagram 3D - Download

DingDangSQ AMA

Benefits of creating Flutter Application integrated with Artificial Intelligence

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
stackpython

stackpython

Full Stack Python Developers

More from Medium

Virtual environment set up for Django Application

How to set up a Project in Django

Create Auth & Crud With Django

Mixins in Django