Disclaimer: the following is my opinion and not intended to be legal advice -- consult a licensed attorney for that.
In general, using psycopg2/PostGIS with your GeoDjango project does not make it subject to the GPLv2. I'll speak about PostGIS since others have already addressed the question as it relates to psycopg2.
Unlike the other geospatial libraries that it uses, GeoDjango does not 'link' to PostGIS. PostgreSQL is what is linked to the PostGIS library (liblwgeom.so
), and in doing exposes a wide selection of SQL functions. GeoDjango calls the SQL functions and uses their output to do what it does. Let's examine term 0 of the GPLv2:
This License applies to any program
or other work which contains a notice
placed by the copyright holder saying
it may be distributed under the terms
of this General Public License. The
"Program", below, refers to any such
program or work, and a "work based on
the Program" means either the Program
or any derivative work under copyright
law: that is to say, a work containing
the Program or a portion of it, either
verbatim or with modifications and/or
translated into another language.
...
Activities other than copying,
distribution and modification are not
covered by this License; they are
outside its scope. The act of running
the Program is not restricted, and the
output from the Program is covered
only if its contents constitute a work
based on the Program (independent of
having been made by running the
Program). Whether that is true depends
on what the Program does.
Because GeoDjango is just running PostGIS (by calling its public SQL API functions), and the output of PostGIS is geospatial data and/or numeric values (not source code based on PostGIS) it's clear to me that GeoDjango (or an app built with it) is not covered by the GPL because it is not copying, modifying, distributing, nor a derivative work of GPL code.
Notice I said "in general" at the beginning. If you are distributing your GeoDjango application including psycopg2 and PostGIS, then your code may be subject to the GPL. For web applications this is typically not a problem, because the code is almost never distributed to others like traditional shrink-wrapped software. The code is running on your server, and the only thing your distributing is output of your program (e.g., HTML) to the users (sidebar: this is why I avoid GPL-licensed JavaScript libraries like the plague). This is how Google can keep their heavily-modified Linux kernel to themselves, because their modifications never leave the servers at Google.
Bottom-line: if you are actually selling/distributing a GeoDjango application to end-users (they get a copy of the application), then do not include the GPL-licensed prerequisites to avoid triggering the licensing requirements on your proprietary code. In other words, install those libraries on-site so that you cannot be considered to be "distributing" GPL source/object code with your closed-source application.