Search code examples
djangoupgradecompatibility

Django 1.5 - 'module' object has no attribute 'simple_class_factory'


I've set up a new server with Django 1.5.4 to test one of my applications and have encountered a problem (the app is working fine in Django 1.4.2)

Django Version: 1.5.4
Exception Type: AttributeError
Exception Value: 'module' object has no attribute 'simple_class_factory'
Exception Location: /usr/local/lib/python2.7/dist-packages/Django-1.5.4-py2.7.egg/django/contrib/se‌​ssions/serializers.py in loads, line 17 Python
Executable: /usr/bin/python Python Version: 2.7.3 

Any suggestions?

This may be related but I'm stumped: https://code.djangoproject.com/ticket/20289


Solution

  • There are some user session objects created in Django 1.4, that are not compatible with your newer Django installation. You need to clear user sessions:

    python manage.py clearsessions
    

    This will clear all the session data from the server. Unfortunately if your SESSION_ENGINE is set to signed_cookies the session data is kept in users' browsers and not the server, so clearing it on the server won't do much.

    You can invalidate all the old cookies on users' computers, by changing the SECRET_KEY setting (there is a generator you can use to get another random value).

    Alternatively, if the site is not in production and you are the only user, just clear cookies in your own browser and you will be good to go.