(Solved) TypeError: __init__() got an unexpected keyword argument 'preserve_default'

I get the following error when I run the my python web server using Django 1.7 and django-cms

python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
Unhandled exception in thread started by
Traceback (most recent call last):
  File "/home/ubuntu/.virtual_envs/myproject-env/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 222, in wrapper
    fn(*args, **kwargs)
  File "/home/ubuntu/.virtual_envs/myproject-env/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run
    self.check_migrations()
  File "/home/ubuntu/.virtual_envs/myproject-env/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 159, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File "/home/ubuntu/.virtual_envs/myproject-env/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 17, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/home/ubuntu/.virtual_envs/myproject-env/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 48, in __init__
    self.build_graph()
  File "/home/ubuntu/.virtual_envs/myproject-env/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 173, in build_graph
    self.load_disk()
  File "/home/ubuntu/.virtual_envs/myproject-env/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 103, in load_disk
    migration_module = import_module("%s.%s" % (module_name, migration_name))
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/ubuntu/.virtual_envs/myproject-env/local/lib/python2.7/site-packages/cms/migrations/0007_auto_20141028_1559.py", line 7, in
    class Migration(migrations.Migration):
  File "/home/ubuntu/.virtual_envs/myproject-env/local/lib/python2.7/site-packages/cms/migrations/0007_auto_20141028_1559.py", line 18, in Migration
    preserve_default=True,
TypeError: __init__() got an unexpected keyword argument 'preserve_default'

To solve the issue, try some below steps:
1. uninstall django (<=1.7)
pip uninstall django
The terminal output will show "Successfully uninstalled Django"
2. install django 1.7.8 (~7,4MB)
pip install django==1.7.8
3. Run the command:
python manage.py migrate
Output:
Operations to perform:
  Synchronize unmigrated apps: sitemaps, sekizai, treebeard, djangocms_admin_style
  Apply all migrations: djangocms_flash, djangocms_file, reversion, djangocms_inherit, sessions, admin, djangocms_column, djangocms_text_ckeditor, sites, auth, djangocms_video, menus, contenttypes, djangocms_picture, djangocms_googlemap, djangocms_style, djangocms_link, cms, djangocms_teaser
Synchronizing apps without migrations:
  Creating tables...
  Installing custom SQL...
  Installing indexes...
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying sites.0001_initial... OK
  Applying cms.0001_initial... OK
  Applying cms.0002_auto_20140816_1918... OK
  Applying cms.0003_auto_20140926_2347... OK
  Applying cms.0004_auto_20140924_1038... OK
  Applying cms.0005_auto_20140924_1039... OK
  Applying cms.0006_auto_20140924_1110... OK
  Applying cms.0007_auto_20141028_1559... OK
  Applying cms.0008_auto_20150208_2149... OK
  Applying cms.0008_auto_20150121_0059... OK
  Applying cms.0009_merge... OK
  Applying cms.0010_migrate_use_structure...Users not migrated to use_structure permission, please add the permission manually
 OK
  Applying cms.0011_auto_20150419_1006... OK
  Applying djangocms_column.0001_initial... OK
  Applying djangocms_file.0001_initial... OK
  Applying djangocms_flash.0001_initial... OK
  Applying djangocms_googlemap.0001_initial... OK
  Applying djangocms_inherit.0001_initial... OK
  Applying djangocms_link.0001_initial... OK
  Applying djangocms_link.0002_auto_20140929_1705... OK
  Applying djangocms_link.0003_auto_20150212_1310... OK
  Applying djangocms_picture.0001_initial... OK
  Applying djangocms_style.0001_initial... OK
  Applying djangocms_teaser.0001_initial... OK
  Applying djangocms_text_ckeditor.0001_initial... OK
  Applying djangocms_video.0001_initial... OK
  Applying menus.0001_initial... OK
  Applying reversion.0001_initial... OK
  Applying sessions.0001_initial... OK

Hope this help!






Comments