newbie difficulty using south with pycharm - DatabaseError: no such table: south_migrationhistory

Marg picture Marg · Feb 26, 2012 · Viewed 12.8k times · Source

I'm using sqlite3 and pycharm to learn more about django, and googled to find that south is recommended to make it easier to modify models after they have been created.

I'm trying to follow the advice on http://south.aeracode.org/docs/tutorial/part1.html#starting-off.

The most success I've had so far is to create a simple model and run syncdb before adding south to installed_apps. That way the intial tables are created and I get a chance to create a super user. (Django admin seems to fret if there are no users).

Then I add south to installed_apps, and run django_manage.py schemamigration bookmarks --initial

It seems to work fine. A new directory is created called migrations with a couple of files in it in my app folder and an encouraging message. "Created 0001_initial.py. You can now apply this migration with: ./manage.py migrate bookmarks"

The next step - django_manage.py" migrate bookmarks generates the following error message django.db.utils.DatabaseError: no such table: south_migrationhistory.

I thought that table would be created in the first schememigration step. What am I missing? Can anyone help?

Marg

Answer

kdt picture kdt · Feb 26, 2012

South uses a table if its own to keep track of which migrations have been applied. Before you can apply any migrations, this must have been created, using python ./manage.py syncdb.

As well as for setting up south, you will find syncdb sometimes necessary for non-south apps in your project, such as the very common django.contrib.auth.

Note that as a convenience, you can run both in one go like this

python ./manage.py syncdb --migrate