- Get link
- X
- Other Apps
IPython Notebook (or Jupyter, whatver) is great. Django is useful and I use it for both work and play. The combination would be greatly useful!
My setup is something like this: I have an EC2 machine running Ubuntu, which powers a Django site. I want to be able to launch IPython Notebook on the remote server such that:
- It knows about Django and can import my models properly
- I can just write the code in a web browser on my local machine
- It's secure in that there's not just a stray notebook on the web that anyone can look at
My mom mentioned the Django extension 'shell_plus' the other day, and that turned out to be key to this solution!
Installing stuff:
(I did this a few days ago and don't remember all the details, I *think* it was this simple.)
- IPython Notebook
- http://ipython.org/install.html
- pip install "ipython[notebook]"
- shell_plus via django-extensions
- http://django-extensions.readthedocs.org/en/latest/installation_instructions.html
- pip install django-extensions
Running stuff:
There are a couple steps that I wrote down for myself (and now you) since they are hard to remember until you've done them many times.
First, I connect to the server through an SSH tunnel. On my local machine, I run
ssh -L 9999:localhost:8888 mycoolserver.com
The second port (the 8888) is the remote port. That needs to be 8888 for IPython Notebook, unless you can convince it to run on a different port. The first port (9999) is the local one, and you can change it if you want.
On the remote server, (in the SSH connection I just made, or a separate one, doesn't matter) I launch IPython Notebook using Django's manage.py and shell_plus, with an extra argument to stop it from trying to launch a browser. I want to use a local browser, not a remote one.
./manage.py shell_plus --notebook --no-browser
Back on my local machine, that 9999 I had in the first command comes in to play. I go to Chrome and visit:
http://localhost:9999
And from there, I can do all the normal IPython Notebook and interactive Django shell things! At the same time!
To stop things, I kill the IPython Notebook by killing the ./manage.py process, and then I kill the SSH connection.
- Get link
- X
- Other Apps
Comments
This is very cool! Would this expose your entire Django data model to your IPython notebook in order to run computational analysis on your data?
ReplyDeleteYes! All the django models are exposed. The only thing to be careful of is that your notebook files are in the same directory as manage.py, otherwise import paths are messed up.
DeleteThanks again for the info, Kathleen. You really opened my mind to an idea for a project!
DeleteVery handy, thank you! I used to achieve the same thing by exposing port "8888" on the production server, so I could connect to the socket - your method is much simpler and more secure.
ReplyDeleteAs an developer I have come across this post and i have analysis the topic. Using iPython notebook with Django on a remote server is necessary. So I definitely think this post is much useful.
ReplyDeleteMmorpg oyunları
ReplyDeleteinstagram takipçi satın al
tiktok jeton hilesi
Tiktok jeton hilesi
antalya saç ekimi
referans kimliği nedir
İnstagram Takipçi Satın Al
metin2 pvp serverlar
Instagram Takipçi Satın Al
smm panel
ReplyDeleteSmm Panel
İs İlanlari
instagram takipçi satın al
HIRDAVAT
Https://www.beyazesyateknikservisi.com.tr
SERVİS
tiktok jeton hilesi
Good content. You write beautiful things.
ReplyDeletekorsan taksi
mrbahis
mrbahis
hacklink
sportsbet
taksi
hacklink
vbet
sportsbet
Good text Write good content success. Thank you
ReplyDeletekralbet
slot siteleri
tipobet
kibris bahis siteleri
bonus veren siteler
poker siteleri
betpark
betmatik
This comment has been removed by the author.
ReplyDeletebaşakşehir
ReplyDeletebayrampaşa
beşiktaş
beykoz
beylikdüzü
78E
mecidiyeköy
ReplyDeletesakarya
istanbul
kayseri
ordu
5GV2
https://saglamproxy.com
ReplyDeletemetin2 proxy
proxy satın al
knight online proxy
mobil proxy satın al
0ML
arnavutköy
ReplyDeleteartvin
avcılar
aydın
bağcılar
GONA