ivanov/vim-ipython

How to integrate into django manage shell

Closed this issue · 4 comments

Hi ivanov,

I'm very interested in howto integrate this plugin into django shell management command.

Basically, django uses ipython (if ipython is present) as interactive shell for enhancement. And django offers a hook (by subclass) to customize this behavior. Please see django changeset #14895.

My question is that could we get the ipython running information, something like --existing --shell=xxx --iopub=xxx --stdin=xxx --hb=xxx, which is required by this plugin(?) without running qtconsole? If it couldn't, how to embed qtconsole in the django manage shell?

Hope it's a right place to ask this question. Sorry for my poor English.
And please let me know if it's a stupid question, since there is an old way: just setup django environment when qtconsole starts up, which I do not really like.

Thanks,

My question is that could we get the ipython running information, something like --existing --shell=xxx --iopub=xxx --stdin=xxx --hb=xxx, which is required by this plugin(?) without running qtconsole

yes, qtconsole is not required. From vim-ipython README: In the current git trunk of IPython, you can use ipython kernel to create a kernel and get the connection string to use for any frontend (including vim-ipython). If you are still using 0.11, you can launch a regular kernel using python -c "from IPython.zmq.ipkernel import main; main()

As far as implementing this functionality in Django, as far as I know, you can currently do the equivalent of ipython kernel using the python API, and get the connection information to use for vim-ipython - but there isn't currently a way to hook up an old-school terminal-based ipython session to it - I believe this functionality is being worked on in ipython/ipython#708

It's not a stupid question at all - it's just more of a question for IPython itself - so I encourage you to ask it on the IPython-User list

I'll go ahead and close this issue - please reopen it if you need further changes in vim-ipython to make the Django shell interaction work.

Thank you so much. No more questions:)

Hi guys, not sure if this is useful or if im out of date here, but ive found a partial solution to this issue, im using django-extensions and ipython installed in the virtualenv. i have then added 'console' to the django extensions params as ...

IPYTHON_ARGUMENTS = [
'console'
]

in django settings.py

after firing up vim and making sure all vim-ipython requiremets were met && i was editing a .py file
i could send to the ipython session and had access to the dynamically loaded ipython session into django, I have not had chance to test all the functionality but it appears to be working in a basic manner. would be interested to hear if this helps
Ipython 3.2.1
django 1.8
django-extensions 1.5.7
vim 7.4.827
Cheers D