Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. (setq python-shell-interpreter "python"
  2. python-shell-interpreter-args "-i /absolute/path/to/manage.py shell_plus")
  3.  
  4. (defun start-my-ipython-term ()
  5. (interactive)
  6. (ansi-term "/usr/bin/ipython"))
  7. (global-set-key (kbd "<your keybinding here>") 'start-my-ipython-term)
  8.  
  9. #!/bin/sh
  10. set -e
  11.  
  12. /bin/echo -n "Select Django project/dir, or press enter for plain ipython: "
  13.  
  14. read selection
  15. case $selection in
  16. '') exec ipython ;;
  17. project) cd /Users/japhy/Projekty/some/project/dir ;;
  18. # other often used projects go here
  19. *) cd $selection ;;
  20. esac
  21. exec python manage.py shell
  22.  
  23. #!/bin/sh
  24. set -e
  25.  
  26. /bin/echo -n "Select Django project/dir, or press enter for plain ipython: "
  27.  
  28. read selection
  29. case $selection in
  30. '') exec ipython ;;
  31. project) cd /Users/japhy/Projekty/some/project/dir ;;
  32. # other often used projects go here
  33. *) cd $selection ;;
  34. esac
  35. exec python manage.py shell
  36.  
  37. ((python-mode
  38. (python-shell-interpreter . "python")
  39. (python-shell-interpreter-args . "/home/youruser/code/yourproject/manage.py shell")
  40. (python-shell-prompt-regexp . "In \[[0-9]+\]: ")
  41. (python-shell-prompt-output-regexp . "Out\[[0-9]+\]: ")
  42. (python-shell-completion-setup-code . "from IPython.core.completerlib import module_completion")
  43. (python-shell-completion-module-string-code . "';'.join(module_completion('''%s'''))n")
  44. (python-shell-completion-string-code . "';'.join(get_ipython().Completer.all_completions('''%s'''))n")
  45. (python-shell-extra-pythonpaths "/home/youruser/code/yourproject/apps/")
  46. (python-shell-virtualenv-path . "/home/youruser/.virtualenvs/yourproject")))
  47.  
  48. M-x shell
  49.  
  50. prompt> cd path/to/my/django/directory
  51. prompt> python manage.py shell
  52. Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
  53. [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
  54. Type "help", "copyright", "credits" or "license" for more information.
  55. (InteractiveConsole)
  56. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement