I started out a few Django projects using SQLite as the DB backend a while back, and decided to upgrade them to PostgreSQL. Turns out using the
loaddata, the switch can be fairly smooth. The steps turned out to be something like:
Create empty database in PostgreSQL
Copy the existing project's
new_settings.pyto replace the SQLite connection info with PgSQL info.
./manage.py syncdb --settings=new_settings(note that there's not a '.py' at the end of that parameter) to create the PgSQL tables (and also test the connection info). Say 'no' when asked if you want to create a user.
./manage.py dbshell --settings=new_settingsto get into the psql shell, to clean out a few tables populated by
delete from auth_permission;
delete from django_content_type;
Dump the data from the old DB backend with:
./manage.py dumpdata >olddata.json
Load the data into the new DB backend with:
./manage.py loaddata --settings=new_settings olddata.json
Swap the settings files:
mv settings.py old_settings.py; mv new_settings.py settings.py
Restart the server
Barring any complications, the entire switch can take just a few minutes. Of course, for anything you really care about you'd do some more testing before going live, but that's up to you.