Create your working environment for web development

Wenbin Yang
3 min readApr 12, 2022

--

Who doesn’t like a beautiful website? It would be even better if you could create your own ones. That’s exactly the reason why I have been trying my hand at web development in my free time.

However, before we dive into the sea of web development, we’d better prepare ourselves with some efficient tools.

I have tried lots of editors, such as Notepad++, Atom, and plenty of programming languages like C, C++, MATLAB, and Python. Of course, every editor/language has its own strength. However, Visual Studio Code (VScode) + Python is the most versatile combination I’ve found so far. (Also, VScode and Python are used in numerous tutorials and videos.)

Actually, it is quite easy to set up a working environment with VScode and Python. I’ll walk you through it step-by-step so that you can have a pleasant working environment for your projects.

Outline

  1. Download and install Anaconda Python
  2. Create a virtual environment from Anaconda prompt
  3. Download and install VScode
  4. Link Anaconda with VScode terminal
  5. Set up proxy for Anaconda (optional)
  6. Install necessary packages in the virtual environment
  7. Test your working environment

1. Download and install Anaconda Python

Just go to this webpage and then click on Download. If you are using Mac/Linux, click on the corresponding icon, then you will be directed to the right place for downloading.

After the download is complete, just click to install (use all the default options).

2. Create a virtual environment in Anaconda

A virtual environment is like a lunch box. It is a separate (virtual) space for your project. Even ifyou make a mistake, it won’t affect the settings in other environments. What you are doing in environment A won’t affect things in environment B.

To create a virtual environment in Anaconda, it takes two steps:

  1. search “Anaconda Prompt” in the search bar and open it
  2. run conda create -n myenv python=3.9, here, myenv is the name for your environment, and you can change it to whatever you like; python=3.9 is an option to install a specific version of python (3.9 in this case) for the new environment.

3. Download and install VScode

Go to this webpage and download the installer for your system. For me, it’s User Installer: 64 bit for Windows

4. Link Anaconda with VScode terminal

VScode is more powerful than a traditional editor. You can run commands within VScode. The goal is to run Anaconda commands (and other commands) within VScode so that you can have an integrated working environment and don’t need to switch windows.

To achieve this, it’s very easy.

  1. Search “Anaconda Prompt” in the search bar and open it (it would be the last time you need Anaconda Prompt)
  2. Run conda init powershell

Now, you can open VScode to check whether Anaconda is linked with VScode terminal

  1. On the top panel of VScode, click on “Terminal->New Terminal”
  2. Run conda activate myenv, myenv is the name for the virtual environment you've created in step 2.

5. Set up proxy for Anaconda (optional)

If you are using a computer from your company/university, you might need to set up a proxy to install packages in Anaconda.

To do this, you can run:

  • conda config --set proxy_servers.http http://id:pw@address:port and
  • conda config --set proxy_servers.https http://id:pw@address:port

There are also other options if you need.

6. Install necessary packages in the virtual environment

To do web development with Python, I chose Django as the main framework. Therefore, we need to install some packages. To do this, it’s quite simple and neat. If you still have your VScode terminal open, make sure the environment is correct; for me, there’s (myenv) in the terminal), simply run pip install Django

7. Test your working environment

In your VScode terminal, run:

  • Python
  • import django
  • print(django.get_version())

If you see a number (e.g., 4.1), congrats! You have successfully set up a working environment for web development.

--

--

Wenbin Yang

Tech nerd who loves design, NOT a native English speaker