[Django]-How do I install Python/Django Modules?


you can install all dependencies in once, if there is a requirements.txt file! you just have to run the follow command:

pip install -r requirements.txt

otherwise you can install one by one:

pip install django-cms

Here is the PIP documentation:

if you are used to ruby, you can compared to ruby GEM


The entries in INSTALLED_APPS are package designations. Packages are a way of structuring Python’s module namespace.

When importing a package, Python searches through the directories on sys.path looking for the package subdirectory.

So python has some designated places to look for packages.

To install packages by name to the right location on your system, you could download some python source code and run the setup.py script (usually provided by libraries and applications).

$ cd /tmp
$ wget http://pypi.python.org/packages/source/p/pytz/pytz-2011n.tar.bz2
$ tar xvfj pytz-2011n.tar.bz2
$ cd pytz-2011n
$ python setup.py install

There are, however, shortcuts to this, namely easy_install and it’s successor pip. With these tools, installation of a third-party package (or django app) boils down to:

$ pip install pytz

Or, if you use the systems default Python installation:

$ sudo pip install pytz

That’s it. You can now use this library, whereever you want. To check, if it installed correctly, just try it in the console:

$ python
Python 2.7.2 (default, Aug 20 2011, 05:03:24)
>>> import pytz # you would get an ImportError, if pytz could not be found
>>> pytz.__version__ 

Now for the sake of brevity (this post is much to long already), let’s assume pytz were some third party django application. You would just write:


And pytz would be available in your project.

Note: I you have the time, please take a look at Tools of the Modern Python Hacker: Virtualenv, Fabric and Pip blog post, which highlights some great python infrastructure tools.


Leave a comment