0% found this document useful (0 votes)
18 views

Using The Autograder With Ngrok: Pythonanywhere

The document provides instructions for using ngrok to submit locally run applications to an autograder. Ngrok allows exposing a local web server to the internet by tunneling traffic through ngrok's servers. It explains how to install and run ngrok on Mac and Windows, which will provide a publicly accessible URL that can be used to submit applications to the autograder for testing, even when running locally rather than on PythonAnywhere. Each time ngrok is run it will generate a new public URL, unless a paid static URL is obtained from ngrok.

Uploaded by

Alejo Zambrano
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Using The Autograder With Ngrok: Pythonanywhere

The document provides instructions for using ngrok to submit locally run applications to an autograder. Ngrok allows exposing a local web server to the internet by tunneling traffic through ngrok's servers. It explains how to install and run ngrok on Mac and Windows, which will provide a publicly accessible URL that can be used to submit applications to the autograder for testing, even when running locally rather than on PythonAnywhere. Each time ngrok is run it will generate a new public URL, unless a paid static URL is obtained from ngrok.

Uploaded by

Alejo Zambrano
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Using the Autograder with ngrok

The assignments for this course are expected to be run on PythonAnywhere and as such
they have a globally accessible URL like https://drchuck.pythonanywhere.com and can be
directly submitted to the autograder for testing.

For whatever reason, you might prefer to install and run Django locally on your computer.
This is a fine solution for the course, but to submit the applications on your local computer
to the autograder, you need to use a tool like ngrok or localtunnel.

This document serves as a quick guide for using ngrok to submit your applications to the
autograder.

Installing ngrok for Autograding

Installing ngrok is very simple, you can download a ZIP file from https://ngrok.com/ and
unzip that file anywhere on your computer. You might want to read the documentation on
the web site to familiarize yourself with ngrok. They have nice diagrams that explain how
ngrok works and why ngrok is needed to allow access to your local web server.

Running ngrok on Apple

Download the ngrok.zip file to your Downloads folder and then extract it by double
clicking on the downloaded file and it will unzip and produce a single file called ngrok.
You can put this file anywhere on your computer but for now we will just execute it from
the Downloads folder. Make sure your Django application is up and running and then open
up a Terminal Window as follows:

$ cd Downloads/
$ ls
ngrok ngrok_2.0.19_darwin_amd64.zip
$ ./ngrok http 8000

Tunnel Status online


Version 2.0.19/2.0.19
Web Interface http://127.0.0.1:4040
Forwarding http://c5343c6e.ngrok.io -> localhost:8000
Forwarding https://c5343c6e.ngrok.io -> localhost:8000

Connections ttl opn rt1 rt5 p50 p90


0 0 0.00 0.00 0.00 0.00

Replace "8000" with whatever port your web server is running on. Then nagivate in your
browser to the address that ngrok has chosen for you. Do not include the port number on
the ngrok url.

http://c5343c6e.ngrok.io
At that point you should see the same thing as you would see if you went to
http://localhost:8000/

And you can go to paths other than the root like:


http://c5343c6e.ngrok.io/catalog

Your local web server will be visible to the Internet at the ngrok-chosen address until you
end the ngrok application. To terminate the ngrok on the Apple, simply press "CTRL-C"
to aport the program. At that point, your local web server can no longer be accessed
through ngrok.

Each time you run ngrok you will get a new address unless you sign up and pay for an
address that does not change each time you run it.

Running ngrok on Windows

Download the ngrok.zip file to your Downloads folder and then extract it by clicking on
the downloaded file and selecting "Extract All". It will make a folder like
"ngrok_2.0.19_windows_386" and in that folder, you will find a single file named
ngrok.exe. You You can put this file anywhere on your computer but for now we will just
execute it from the Downloads folder. Make sure your Django application is up and
running and then open up a Command Line window as follows:

C:\...> cd Downloads\ngrok_2.0.19_windows_386
C:\...> ngrok http 8000

Tunnel Status online


Version 2.0.19/2.0.19
Web Interface http://127.0.0.1:4040
Forwarding http://c5343c6e.ngrok.io -> localhost:8000
Forwarding https://c5343c6e.ngrok.io -> localhost:8000

Replace "8000" with whatever port your web server is running on. Then nagivate in your
browser to the address that ngrok has chosen for you. Do not include the port number on
the ngrok address.
http://c5343c6e.ngrok.io

At that point you should see the same thing as you would see if you went to
http://localhost:8000/

And you can go to paths other than the root like:


http://c5343c6e.ngrok.io/catalog
Your local web server will be visible to the Internet at the ngrok-chosen address until you
end the ngrok application. To terminate the ngrok on the Apple, simply press "CTRL-Z"
to aport the program. At that point, your local web server can no longer be accessed
through ngrok.

Each time you run ngrok you will get a new address unless you sign up and pay for an
address that does not change each time you run it.

You might also like