For your information, I am going to use Microsoft Visual Code Studio to develop Python software based on django.


  1. Install Visual Code Studio
  2. Install Python Extension - https://marketplace.visualstudio.com/items?itemName=ms-python.python
  3. Install a version of Python 3

    brew install python3

    If you face any issue while installing by brew, please run following command to get more help.

    brew doctor

    Once Python 3 is installed, you should run following command for your convenience

    brew link python

    If you face error something like below

    Linking /usr/local/Cellar/python/3.7.1... Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

    You can fix it as following

    sudo mkdir /usr/local/Frameworks
    sudo chown $(whoami):admin /usr/local/Frameworks
    brew link python
  4. Create a project environment for Django

    mkdir py
    cd py
    python3 -m venv env

    From above, I just created project folder as py and setup virtual environment that means we will start project on that folder. You can use different name instead of "py".

  5. Open the project folder by running VS Code and using the File > Open Folder command.

  6. In VS Code, open the Command Palette (View > Command Palette or (⇧⌘P)). Then select the Python: Select Interpreter command:

    And select venv as you created



  7. Run Terminal: Create New Integrated Terminal (⌃⇧`) from the Command Palette, which creates a terminal and automatically activates the virtual environment by running its activation script.

  8. The selected environment appears on the left side of the VS Code status bar, and notice the "(venv)" indicator that tells you that you're using a virtual environment:


  9. Install Django in the virtual environment by running one of the following commands in the VS Code Terminal:

    python -m pip install django

You now have a self-contained environment ready for writing Django code. VS Code activates the environment automatically when you use Terminal: Create New Integrated Terminal.


The documentation I referenced is actually located at https://code.visualstudio.com/docs/python/tutorial-django, so you can know more if you have any additional doubt or curious.