Once we look at how a Django development environment in Visual Studio with PTVS is set up, we can start analyzing some powerful libraries for Django and how to use them in Visual Studio. Over the years, lots of developers have created powerful libraries and tools for Django that speed up various aspects of the development cycle. We are going to take a closer look at some of them here to see how they integrate in Visual Studio and PTVS.
In this chapter, we will analyze two libraries that are useful for a Django developer in two different aspects: automatizing tasks using the Fabric library, and managing model migrations on Django with South.
We have already learned how to install new packages in PTVS using the GUI tools that it provides. Now, we will learn more about the criteria for choosing one package index over another; in other words, when to choose easy_install
over pip
.
Generally speaking, using pip
is much better than using easy_install
, and there are major reasons for this. As Ian Bicking, the creator of pip
, wrote in his own introduction to pip
, the advantages are as follows:
pip
keeps track of why that package was required.Git
, Mercurial
, and Bazaar
).It may seem that there are no reasons to choose easy_install
over pip
. However, this is where careful consideration is needed.
There is a caveat that makes the choice really hard for Windows environments: some libraries or dependencies are written in Python C, which is a way for Python to call libraries written in C/C++. To compile these libraries on your Windows machine, you have to install the exact same version of the original compiler that has been used to compile to the original interpreter. For example, you will need the C++ compiler of Visual Studio 2008 if you use Python 2.7 or Visual Studio 2010 for Python 3.
This is due to a long tradition where Python extension modules must be built with the same compiler version (more specifically, a CRT version) as Python itself, which is mentioned at https://mail.python.org/pipermail/python-list/2010-April/573606.html.
Using the easy_install
package installer, the precompiled packages are downloaded and installed into the system's site-packages
folder.
If you don't know what kind of library you are importing, you should go with pip
. If it encounters a problem during the compilation process of the installation, you can uninstall the library and reinstall it using easy_install
.
Generally, most libraries that have low-level capabilities (for example, cryptography, graphics, and mathematical functions) and interaction with other software (for example, drivers) use Python C extensions.
3.145.70.170