Search code examples
djangowindows-subsystem-for-linuxdevelopment-environment

Should I move windows project folder into WSL?


I'm trying to set up a work environment on a new machine and I am a bit confused how best to procede.

I've set up a new windows machine and have WSL2 set-up; I plan on using that with VS Code for my development environment.

I have a previous django project that I want to continue working on stored in a folder in a thumb drive.

  1. Do I move the [windows] project folder into the linux folder system and everything is magically ready to go?
  2. Will my previous virtual environment in the existing folder still work or do I need to start a new one?
  3. Is it better to just start a new folder via linux terminal and pull the project from github?
  4. I haven't installed pip, python, or django on the windows OR linux side just yet either.

Any other things to look out for while setting this up would be really appreciated. I'm trying to avoid headaches later by getting it all set-up correctly now!


Solution

  • I would pull it from github, and make sure you have the correct settings for line endings, since they are different between windows and linux. Just let git manage these though:

    https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings

    Some other suggestions:

    • Use a version manager in linux to manage your python versions - something like pyenv or asdf. It will make life easier.
    • Make sure to always create a virtual environment for everything and don't pip install anything in your main python. (I use direnv for virtual env management)
    • The single exception to the previous suggestion is pipx, which I do install in the main python and then use to install things like cli tools, black, isort, pip-tools etc.
    • Configure VScode to use the pipx installed versions of black, flake8 etc. for linting purposes.
    • If you're using Docker, enable the WSL integration for your WSL flavour (probably Ubuntu). Note that docker desktop needs starting before your WSL session.