Using The Autograder With Ngrok: Pythonanywhere
Using The Autograder With Ngrok: Pythonanywhere
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 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.
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
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/
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.
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
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/
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.