This is my first post here, so I hope this is on-topic. If not, if you can provide some links to where it makes sense to ask it i’ll ask there.
I’ve been using VS Code a while with Django, and on some projects, I can navigate source code in a project, of libraries I might import, which is incredibly helpful.
For example if I have some code here, I can sometimes right click on any of the imported libraries to see the underlying source code and if necessary, drop into a debugging session:
from django.views.generic import TemplateView from rest_framework.authtoken.views import obtain_auth_token from django.contrib.flatpages.views import flatpage # some of my own code goes here using flatpage, for example def some_method(blah): # not real code boop = blah.do_stuff() return flatpage(boop)
However, while I’m grateful when I can do it, I don’t understand what I need to have set up with VS Code, so I can consistently navigate source code of dependencies as well as my own code.
I understand it’s likely something to do with having a running language server, and the right virtual env, but it seemed like shaving yaks to dive into this myself without asking.
So here’s my question / call for help.
If you’re a django user, and you use VS Code, and you can reliably navigate the source code of libraries you depend on, without resorting to hacks like calling
pipenv open library name in another session, can you please share your setup, or link to some docs you have found useful?
I’ve used django on and off since 2008, so I’m not new to the framework, but I’m a bit embarassed to say I’ve never found a setup I’m really happy with, and it seemed worth asking here as I can’t be the only person who:
- a) likes using django
- b) uses VS Code
- c) finds it useful to navigate and if necessary edit the code of dependencies when investigating bugs during development
P.S I’m aware of videos like this from justdjango, on VS Code setup. If it helps, I currently use pipenv for managing virtual environments, but, I’m pretty agnostic when it comes to venv management.