microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.32k stars 1.18k forks source link

Django's 'shell' command should use the Python Interactive window #13027

Open rchiodo opened 4 years ago

rchiodo commented 4 years ago

The tutorial for Django has this command:

python manage.py shell

It would be cool if this could use the interactive window instead (it opens an ipython kernel)

rchiodo commented 4 years ago

I believe this would work if we set the DJANGO_SETTINGS_MODULE environment variable before starting.

(See here for more information: https://www.b-list.org/weblog/2007/sep/22/standalone-django-scripts/)

eleanorjboyd commented 10 months ago

@anthonykim1 curious of your thoughts on this and if this is something that could relate to your repl work.

anthonykim1 commented 10 months ago

Thanks @eleanorjboyd
There are still much work and sorting that needs to happen between plain REPL in Python for VS Code vs. Interactive Window . I know Django is a web framework but still lacking some context for Django shell other than its a shell that reads settings.py and goes and find all application in settings.py and then preload those application then gives you a shell.

@rchiodo Are there any specific reasons you wanted to use Python Interactive window and/or iPython? This would be helpful in thinking about what is needed in REPL rewrite that is happening #21707 and the native VS Code REPL experience towards the end of the rewrite.

rchiodo commented 10 months ago

Oh so you could get intellisense and have the output like a notebook window. Here's a good demonstration of the django shell:

https://www.nickmccullum.com/useful-features-django-shell/

It looks a lot like an IPython shell.

rchiodo commented 10 months ago

Meaning you'd run python code to check how things look.