Appendix G. Developing Django with Visual Studio

Regardless of what you might hear trolling around the Internet, Microsoft Visual Studio (VS) has always been an extremely capable and powerful Integrated Development Environment (IDE). As a developer for multiple platforms, I have dabbled in just about everything else out there and have always ended up back with VS.

The biggest barriers to wider uptake of VS in the past have been (in my opinion):

  • Lack of good support for languages outside of Microsoft's ecosystem (C++, C# and VB)
  • Cost of the fully featured IDE. Previous incarnations of Microsoft 'free' IDE's have fallen a bit short of being useful for professional development

With the release of Visual Studio Community Editions a few years ago and the more recent release of Python Tools for Visual Studio (PTVS), this situation has changed dramatically for the better. So much so that I now do all my development in VS-both Microsoft technologies and Python and Django.

I am not going to go on with the virtues of VS, lest I begin to sound like a commercial for Microsoft, so let's assume that you have at least decided to give VS and PTVS a go.

Firstly, I will explain how to install VS and PTVS on your Windows box and then I will give you a quick overview of all the cool Django and Python tools that you have at your disposal.

Installing Visual Studio

Note

Before you start

Because it's still Microsoft, we can't get past the fact that VS is a big install.

To minimize the chances of grief, please:

  1. Turn off your antivirus for the duration of the install
  2. Make sure you have a good Internet connection. Wired is better than wireless
  3. Pause other memory/disk hogs like OneDrive and Dropbox
  4. Close every application that doesn't have to be open

Once you have taken careful note of the preceding warning, jump on to the Visual Studio website (https://www.visualstudio.com/) and download the free Visual Studio Community Edition 2015 (Figure G.1):

Installing Visual Studio

Figure G.1: Visual Studio Downloads

Launch the downloaded installer file, make sure the default install option is selected (Figure G.2) and click install:

Installing Visual Studio

Figure G.2: Visual Studio's default install

Now's the time to go make yourself a coffee. Or seven. Microsoft, remember-it's going to take a while. Depending on your Internet connection this can take anywhere from 15 minutes to more than an hour.

In a few rare cases it will fail. This is always (in my experience) either forgetting to turn antivirus off or a momentary dropout in your Internet connection. Luckily VS's recovery process is pretty robust and I have found rebooting and restarting the install after a failure works every time. VS will even remember where it's up to, so you don't have to start all over again.

Install PTVS and Web Essentials

Once you have installed VS, it's time to add Python Tools for Visual Studio (PTVS) and Visual Studio Web Essentials. From the top menu, select Tools > Extensions and Updates (Figure G.3):

Install PTVS and Web Essentials

Figure G.3: Install Visual Studio's extension

Once the Extensions and Updates window opens, select Online from the dropdown on the left to go to the VS online application gallery. Type python in the search box on the top right and the PTVS extension should appear on the top of the list (Figure G.4):

Install PTVS and Web Essentials

Figure G.4: Install PTVS extension

Repeat the same process for VS Web Essentials (Figure G.5). Note that, depending on the VS build and what extensions have been installed previously, Web Essentials may already be installed. If this is the case, the Download button will be replaced with a green tick icon:

Install PTVS and Web Essentials

Figure G.5: Install Web Essentials extension

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset