This question: Automatic import of models at startup Django shell contains answers explaining how to import models at startup using shell_plus, but there is no answer on how to run the code as a whole.
But is there an easy way to run a python script?
python manage.py shell [or shell_plus] --run=script.py
I would run the script as if you typed all this when the shell started.
I understand that you can import things into the shell, but then they get stuck in the namespace.
I would suggest that ipython should have a way to run the script and then import its locals() into the toplevel namespace. In this case, you can just do %magic script.py , and we will stop just one step, and that will be fine.
Changing the way shell starts should be great - the main goal is to simply create a file that starts when the shell starts.
fastmultiplication
source share