Making Django App Publicly Accessible With Ngrok

Sometimes when developing our Django application, we need to make it publicly accessible or use https, for example when testing OAuth authentication sometimes https is enforced, or when testing Shopify webhooks (where the request is executed on Shopify server, so we need to make it publicly available), or simply when we want to share it with a friend without deploying it live.

To achieve it We can use ngrok to redirect what you are running on localhost to publicly available ngrok URL. Let’s get started.

Installing ngrok

on mac, we can install it simply with brew.

brew cask install ngrok

For windows we can download it from here.

Running ngrok

o start ngrok we simply type “ngrok http [port]“, in our case we use port 8000, because it’s the default Django development server port.

ngrok http 8000

you will see the ngrok screen, and your ngrok URL, in my case it’s, you also have https connection available.

ngrok running

Now go to and add to ALLOWED_HOSTS. Run your Django development server.

python runserver

Now your Django App is available to the world under you can test external APIs, authentications, or share what you working on with your friends.