Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring django south with PostgreSQL

I can't get my site running with south. I've successfully installed south, and I can 'import south' successfully.

./manage.py shell
>>> import south
>>>

However, once I add 'south' to INSTALLED_APPS, and run ./manage.py syncdb (to complete the installation), I get the following error:

There is no South database module 'south.db.django.db.backends.postgresql_psycopg2' for your database. Please either choose a supported database, check for SOUTH_DATABASE_ADAPTER[S] settings, or remove South from INSTALLED_APPS.

I'm using a PostgreSQL database, and the postgresql_psycopg2 library. I'm confused, because Postgres is definitely a supported database. Do I need to manually configure SOUTH_DATABASE_ADAPTER in settings.py?

Edit: Here are my database settings. I know they work -- the (test) server I'm trying to get this running on has been talking to the DB properly for weeks.

DATABASE_ENGINE = 'postgresql_psycopg2' 
DATABASE_NAME = 'iknowthisiscorrect' 
DATABASE_HOST = '' #localhost
DATABASE_PORT = '5432'  # I've configured Postgres to use this port
like image 828
raviv Avatar asked Apr 22 '26 20:04

raviv


1 Answers

This is actually a bug in the later versions of south, they're not completely backwardly compatible and assume an import from django.db.utils which doesn't exist until django 1.2.

You can patch around this very basically, open up south/db/generic.py and edit line 6:

try:
    from django.db.utils import DatabaseError
except:
    from django.db import DatabaseError

Note: this import is also in other db/*.py files, but I'm not using oracle or firebird so haven't tested with those.

Second note: doesn't help that django 1.1 transactions aren't alias aware and probably won't let south actually work.

like image 144
Simon Avatar answered Apr 24 '26 23:04

Simon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!