[英]Interactive shell in Django
I would like to get an interactive shell with the code, but I don't even know if such thing exits.我想用代码获得一个交互式 shell,但我什至不知道这样的东西是否存在。 Could anyone be able to help me at this point?
任何人都可以在这一点上帮助我吗?
EDIT :编辑 :
I already know we could use python manage.py shell
, but I would like something we could insert in the code in such a way we do not have to re-import all the libraries in the shell.我已经知道我们可以使用
python manage.py shell
,但我希望我们可以在代码中插入一些东西,这样我们就不必重新导入 shell 中的所有库。
This command will help you to load all packages.此命令将帮助您加载所有包。
python manage.py shell_plus
Reference link http://django-extensions.readthedocs.io/en/latest/index.html参考链接http://django-extensions.readthedocs.io/en/latest/index.html
Try with https://docs.djangoproject.com/en/1.10/ref/django-admin/#shell尝试使用https://docs.djangoproject.com/en/1.10/ref/django-admin/#shell
django-admin shell
Or或者
python manage.py shell
root django 项目然后python manage.py shell
在这里执行视图操作。
You also can use a pydev console in PyCharm, which can load anything you want, if you set up it in PyCharm's preferences.您还可以在 PyCharm 中使用 pydev 控制台,如果您在 PyCharm 的首选项中进行设置,它可以加载您想要的任何内容。
Mine is here:我的在这里:
/Users/waryak/.virtualenvs/python3.8_django/bin/python3.8 /Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevconsole.py --mode=client --port=49852
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.