Skip to content

Instantly share code, notes, and snippets.

@vivekrk1992
Last active June 6, 2023 16:40
Show Gist options
  • Save vivekrk1992/5c26302747140d5ebbed99bea3307f9f to your computer and use it in GitHub Desktop.
Save vivekrk1992/5c26302747140d5ebbed99bea3307f9f to your computer and use it in GitHub Desktop.
configure jupyter with django project and connect to remote server
1. activate your django virtual environment
2. navigate your project directory (not necessary)
3. install ipython via pip
```
pip install ipython
```
4. install django extension via pip
```
pip install django-extensions
```
5. add this in settings.py
```
INSTALLED_APPS = (
...
'django_extensions'
...
```
6. run this command
```
python manage.py shell_plus
```
this command open the django interactive Ipython shell
```
pip install jupyter
```
test run your jupyer notebook in local
```
python manage.py shell_plus --notebook
```
setup server jupyter notebook
```
python manage.py shell_plus --notebook --no-browser
```
setup local
i already connect my local machine to server via ssh public key
so i can make a tunel with local to server via terminal ssh
```
ssh -N -f -L localhost:9000:localhost:8888 root@159.89.173.57
```
run in your browser
```
localhost:9000
```
it asked password or token
this token will generate while run your jupyter in server
so i also add token with browser url
```
ttp://localhost:9002/?token=6c13b914c7644fe(your token)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment