This is more of a test post, but also keep in mind when upgrading python versions to also remove version numbers on some of the requirements.txt stuff ..
in particular psycopg, Pillow .. I just ran pip install Django==<version number> Mezzanine==<version number> Pillow psycopg2
. That worked for me now the django and mezzanine upgrade will have to wait for another day.
Also had some rather strange error RuntimeError: __class__ not set defining 'AbstractBaseUser' as <class 'django.contrib.auth.base_user.AbstractBaseUser
.. which seemed obscure and I did not know where to start .. fortunately I was not the only one (and definitely not the first one) who got this. Found the solution at stackoverflow. Adding those few lines of code fixed it for me. (just in case the page goes offline/changes here the code copied (myenv/lib64/python3.9/site-packages/django/db/models/base.py
):
class ModelBase(type):
"""
Metaclass for all models.
"""
def __new__(cls, name, bases, attrs):
super_new = super(ModelBase, cls).__new__
# Also ensure initialization is only performed for subclasses of Model
# (excluding Model class itself).
parents = [b for b in bases if isinstance(b, ModelBase)]
if not parents:
return super_new(cls, name, bases, attrs)
# Create the class.
module = attrs.pop('__module__')
new_class = super_new(cls, name, bases, {'__module__': module})
# <========== THE CODE BELLOW SHOULD BE ADDED ONLY ======>>
new_attrs = {'__module__': module}
classcell = attrs.pop('__classcell__', None)
if classcell is not None:
new_attrs['__classcell__'] = classcell
new_class = super_new(cls, name, bases, new_attrs)
# <========== THE CODE ABOVE SHOULD BE ADDED ONLY ======>>
# the rest of the class .....
.
Share on Twitter Share on Facebook
Comments
There are currently no comments
New Comment