Problems installing South with Django (south_migrationhistory tables are not created)

I can not get this work to work.

I need the South to migrate for many applications.

  • Loaded south 0.7.3
  • Unpacked, launched setup.py (as he says in the guide)
  • Double checkbox to see if it is in the south where it should be by going to the python interpreter and executing (without errors)

    import south

  • I do

C:\Users\j\iMiCode\imi_admin>python ./manage.py syncdb 

Synchronization ... No devices found.

 Synced: > django.contrib.auth > django.contrib.contenttypes > django.contrib.sessions > django.contrib.sites > django.contrib.messages > django.contrib.admin Not synced (use migrations): - south (use ./manage.py migrate to migrate these) 

- At this point, from what I understand, the south should have been synchronized correctly? Something else I do after this complains that there are no tables with south_migration errors in the database.

PS. I am working with Django 1.2.7, python 2.6, on Windows7

+4
source share
3 answers

It seems to me like a mistake in the South.

This can also be the reason when doing wrong tiges: running schemamigration --auto south , etc. My suggestion would be to install it by running python setup.py install or via easy_install or pip

The southern documentation says: "When the South is added, you need to run ./manage.py syncdb to make the southern migration tracking tables (the South does not use migrations for its models for various reasons).

But your conclusion says that the south skipped creating tables for its models because it thought the southern application was using migrations

As a workaround you can use

 python manage.py syncdb --all 

Makes all tables, regardless of migration, synchronize and

 python manage.py migrate --fake 

to fake migration.

+17
source

For a new application without existing tables, the steps for adding a south are:

  • add "south" to the INSTALLED_APPS list.

  • make sure the application you want to migrate is also in INSTALLED_APPS.

  • run. / manage.py syncdb (or python manage.py syncdb from your project directory). This adds migration tables to the database.

  • from the command line, execute. /manage.py schemamigration yourappname --initial

  • execute. / manage.py migrate yourappname

Based on the error you are giving, it looks like after steps 1 and 2 you forgot to run syncdb to create the migration tables, and the southern application does not find the place where it wants to store the schema migrations.

0
source

I ran into this problem. It turns out that with some magic I created migrations inside the hte south application.

Found:

 ~ $ # cd to python library ~ $ cd `python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"` python2.7/site-packages $ cd south python2.7/site-packages/south $ ls migrations 0001_initial.py 0002_initial.py 0003_initial.py __init__.py 

This is bad, they should not be, and this is what launches the south to skip itself. Removed everything south, reinstalled, and then synced again.

 python2.7/site-packages $ rm -rf south* South* ~ $ pip install south 
0
source

All Articles