In a Django shell, how can I automatically load ipython magic functions?

I want to make the following ipython commands persistent when using the django shell:

%load_ext autoreload %autoreload 2 

Unfortunately, Django does not seem to use my global ipython configuration, so including them in the default_profile file does not work. Is there a way for them to execute automatically when the django shell starts?

+4
source share
1 answer

You can use the django extentions package, which contains the shell_plus command. This command automatically loads models, but you can also use the --notebook attribute. There you can add an autoload option: --ext django_extensions.management.notebook_extension .

See here for more details.

+3
source

Source: https://habr.com/ru/post/1445371/


All Articles