As discussed in the documentation(1):

  • After syncdb, execute an ALTER TABLE statement to convert tables
    ALTER TABLE <tablename> ENGINE=INNODB;
    
  • or, change settings to use the init_command option for MySQLdb:
    # settings.py
    DATABASES = {
        'default': {
             'OPTIONS': {
                 # works because South changes table creation
                 'init_command': 'SET storage_engine=INNODB',
             }
        }
    }
    
  • or, use post_syncdb trick listed in wiki:AlterModelOnSyncDB,
  • or, create a management.py file along with your app, with:
    # management.py
    from django.db import connection
    # syncdb does "import_module('.management', app_name)"
    # IOW, this gets executed before creating the tables.
    connection.cursor().execute('SET storage_engine=InnoDB;')
    
  • or, if you use South(2) for migrations, with:
    # settings.py
    DATABASES = {
        'default': {
            'STORAGE_ENGINE': 'INNODB'
        }
    }
    
  • or, if you can, edit my.cnf
    # my.cnf
    default-storage-engine=InnoDB
    
Last modified 13 years ago Last modified on Dec 7, 2011, 3:33:53 PM
Note: See TracWiki for help on using the wiki.
Back to Top