Automatically import models on Django shell launch

后端 未结 2 768
庸人自扰
庸人自扰 2021-01-30 17:00

I\'m tired of typing from account_import.models import ImportFile every time I open my Django shell. Is there a way to automatically run this command whenever I fir

2条回答
  •  时光取名叫无心
    2021-01-30 17:43

    http://docs.python.org/using/cmdline.html#envvar-PYTHONSTARTUP

    If you set the environment variable PYTHONSTARTUP to a file, this will be run first whenever you start a python shell.

提交回复
热议问题