Test the database connection before trying to determine the installed PostGIS version

I've spent a lot of time trying to figure out why I was getting the following error:

```
Cannot determine PostGIS version for database "test". GeoDjango requires at least PostGIS version 1.3. Was the database created from a spatial database template?
```

after a large amount of rigorous checks to my PostGIS installation, I've figured out that the problem was of a totally different nature. GeoDjango was in fact printing this error also if the database's connection parameters  were wrong and for this reason I've added an additional check which tries to get the PostgreSQL version first. 

If the user tries to start GeoDjango using a wrong database password the output will now looks like:

```
FATAL:  password authentication failed for user "test_user"
```

which makes much more sense...