I'm using django-extensions shell_plus command, but it doesn't save the command history (i.e., ↑ does nothing). Any ideas how to fix this?
            Asked
            
        
        
            Active
            
        
            Viewed 2,080 times
        
    7
            
            
         
    
    
        a paid nerd
        
- 30,702
- 30
- 134
- 179
3 Answers
5
            I had the same problem, and running it with --use-pythonrc fixed it.
python manage.py shell_plus --use-pythonrc
If that fixes it for you, you can create a shell alias to shorten the command. Something like:
alias sp="python manage.py shell_plus --use-pythonrc"
After that, you can just type sp from the directory with manage.py in it. Personally, I put the absolute path to manage.py so I can type sp from anywhere.
Put that alias command in you .bash_profile and it will be available every time you login.
 
    
    
        mhost
        
- 6,930
- 5
- 38
- 45
- 
                    `--use-pythonrc` still doesn't save history in my case: when using UP ARROW, nothing pops out in the shell. What could the possible causes be?: – Constantin Jun 08 '22 at 11:20
2
            
            
        It looks like shell_plus has duplicated code from the Django shell command, but it hasn't been updated to work with IPython >= 0.11. You can see the changes made in Django.
 
    
    
        Thomas K
        
- 39,200
- 7
- 84
- 86
- 
                    1You said "Any ideas how to fix this?". I pointed you to the changes that were made to fix this in almost identical code. I do not see how that can be read as "no". – Thomas K Feb 10 '12 at 19:54
0
            
            
        --use-pythonrc didn't work, but installing ipython or bpython fixed the problem for me.
 
    
    
        nurettin
        
- 11,090
- 5
- 65
- 85