SI 664 autograders rely on ngrok to provide your laptop with a temporary HTTP tunnel and a temporary internet domain in which to communicate with the web server hosting the autograder service.
Visit ngrok, click the "SIGN UP" button, and create an account.
On the Setup and Installation page and choose the appropriate ngrok archive to download:
macOS: https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-amd64.zip
Move the *.zip archive to your user's home folder and then open the terminal and issue the unzip command:
kathrada:~ arwhyte$ unzip /path/to/ngrok-stable-darwin-amd64.zip
Copy the authtoken
command from the ngrok "Setup & Installation" page and run it in the
terminal. This action will add the token to your ngrok.yml
configuration file.
kathrada:~ arwhyte$ ./ngrok authtoken 3X78JfAiBvdUMSiKEeJNf_2ptioVDLB3FFZw6uu1Z32
kathrada:~ arwhyte$ ./ngrok http 8000
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Account Anthony Whyte (Plan: Free)
Version 2.2.8
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://be5bc9dd.ngrok.io -> localhost:8000
Forwarding https://be5bc9dd.ngrok.io -> localhost:8000
Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00
Type "Control" + "C" (CTRL+C) to close the tunnel.
Once you have opened a tunnel open a new browser tab and visit http://localhost:4040 to review tunnel activity. You can inspect HTTP headers and responses as well as replay a request.
Open mysite settings.py
and add a wildcard character ('*') to the ALLOWED_HOSTS
list property.
ALLOWED_HOSTS = ['*']
Otherwise you are likely to encounter a DisallowedHost
exception when using the ngrok temporary
domain.
Construct the ngrok URL by removing the "http://localhost:8000" and replacing it with the ngrok-provided URL:
example: http://localhost:8000/polls/
to https://be5bc9dd.ngrok.io/polls/
Whenever you encounter an SI 664 assignment that involves an autograder do the following:
- Read the exercise directions carefully.
- Activate your Django project virtual environment.
- Start the Django development server.
- Perform the exercise, making changes to your Django app instance as required.
- Start an ngrok tunnel.
- When interacting with the autograder over HTTP replace http://localhost:8000 with the ngrok domain.
- Make frequent use of the ngrok inspector to monitor the HTTP request/response cycle.
- After submitting your assignment and receiving a grade close the tunnel.
The ngrok online documentation is well-written and worth exploring. You can also access the documentation from the terminal:
kathrada:~ arwhyte$ ./ngrok help
This work is licensed under a Creative Commons Attribution 4.0 International License.