I'm attempting to add South management to a preexisting app.
pip install south
Add 'south' to INSTALLED_APPS
Test that South is now there:
$ python manage.py shell
Python 2.7.5+ (default, Feb 27 2014, 19:37:08)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import south
>>>
Also, check that South shows up in manage.py help:
python manage.py help
python manage.py syncdb
Make south manage your models:
python manage.py convert_to_south CaseReport
On other instances:
manage.py migrate app_name 0001 --fake
Make your model changes in models.py
Check what -would- happen (dry run):
python manage.py schemamigration CaseReport --auto --stdout
Run it for real:
python manage.py schemamigration CaseReport --auto
Finally:
python manage.py migrate CaseReport
...but this is tracebacking for me. :(
Running migrations for CaseReport:
- Migrating forwards to 0002_auto__add_field_casereport_date_time_of_last_update.
> CaseReport:0002_auto__add_field_casereport_date_time_of_last_update
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
ignore_ghosts = ignore_ghosts,
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/south/migration/__init__.py", line 220, in migrate_app
success = migrator.migrate_many(target, workplan, database)
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/south/migration/migrators.py", line 254, in migrate_many
result = migrator.__class__.migrate_many(migrator, target, migrations, database)
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/south/migration/migrators.py", line 329, in migrate_many
result = self.migrate(migration, database)
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/south/migration/migrators.py", line 133, in migrate
result = self.run(migration, database)
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/south/migration/migrators.py", line 111, in run
if not south.db.db.has_ddl_transactions:
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/django/utils/functional.py", line 49, in __get__
res = instance.__dict__[self.func.__name__] = self.func(instance)
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/south/db/generic.py", line 124, in has_ddl_transactions
if getattr(connection.features, 'supports_transactions', True):
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/django/utils/functional.py", line 49, in __get__
res = instance.__dict__[self.func.__name__] = self.func(instance)
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 676, in supports_transactions
self.connection.leave_transaction_management()
File "/home/dstromberg/miniconda/envs/CaseReport/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 322, in leave_transaction_management
"Transaction managed block ended with pending COMMIT/ROLLBACK")
django.db.transaction.TransactionManagementError: Transaction managed block ended with pending COMMIT/ROLLBACK
Thanks.