python
is not finding django
because it's not on its path. You can see the list of paths python
looks for modules like this:
$ python
>>> import sys
>>> sys.path
You can import django
if you find the location it is installed, and add that location to python
's path, for example like this:
$ PYTHONPATH=/path/to/django/parent/dir python
>>> import django # should work now
But your real problem is that something's wrong with your python
installation. If you have installed both python
AND django
using apt-get
, then django
should certainly be on python
's path without dirty hacks like above.
That said, when working with Django, your best bet is to NOT use apt-get
but create a virtual environment using virtualenv
(you can install virtualenv
itself using apt-get
), and install Django and other modules your Django site might need using pip
within the virtual environment. That way you can have multiple Django projects side by side, with precisely the Python modules and versions it requires. It's just a few extra steps to do, but definitely worth it and will save you from much frustration in the future.