Use SublimeREPL as Django wrapper
I am learning Django
ah Django
shell
is a commonly used thing, but it is a little frustrating to go back and forth to a terminal window.
I am trying to use SublimeREPL-shell
but it is not working correctly. For example, I can use python manage.py shell
the REPL window to enter the interactive console, but after that all commands and results will not be displayed: it looks something like this.
bash: no job control in this shell
bash-3.2$ python manage.py shell
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
Well the results will show up if I do quit()
, and they all show up (but a little too late ...). Something like that
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> >>> [<Person: John>, <Person: Jane>]
>>> bash-3.2$
So, I wonder if this is the right thing to do?
source to share
Create a new .py file in the manage.py path. it contains them.
#!/usr/bin/env python
# run Django shell in SublimeREPL
# how to use: Meuns > Tools > SublimeREPL > Python > Python - RUN current file
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "[your app].settings")
from django.core.management import execute_from_command_line
execute_from_command_line(['.', 'shell'])
How to use: Menu> Tools> SublimeREPL> Python> Python - current RUN file
source to share