Skip to content

Instantly share code, notes, and snippets.

@victorfsf
Last active May 27, 2017 04:11
Show Gist options
  • Save victorfsf/7381f03052d07226adc55d83d0445b79 to your computer and use it in GitHub Desktop.
Save victorfsf/7381f03052d07226adc55d83d0445b79 to your computer and use it in GitHub Desktop.
Jupyter

Setting up Jupyter to run Django with an enviroment variables file.

Run (the file must include a DJANGO_SETTINGS_MODULE env variable):
export $(cat .env | grep -v ^# | xargs) 
Open Jupyter:
jupyter notebook
After opening a new notebook, run:
import django; django.setup()

Setting up an SSH tunel to access a Jupyter Notebook inside a remote host.

Remote host:
jupyter notebook --no-browser --port=8787
Local host:
ssh -N -f -L localhost:8888:localhost:8787 remote_user@remote_host

Access Jupyter by opening localhost:8888 on your browser.

Killing the SSH tunel process:
ps aux | grep "localhost:8787" | grep -v grep | awk "{ print \$2 }" | xargs kill -9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment