Upgrading mezzanine (forced to due to move to python3.10)

(0 comments)

A recent system update prompted me to actually remove python3.9 .. which was used for my Django pages (including this one). An issue with a depreciated/removed feature in 3.10 made it needed to not just move from 3.9 -> 3.10 but also to upgrade packages.

Upgrading in-place was something I had tried before and it did not go well, so since my Mezzanine is pretty much vanilla I decided to just try to install the latest one and let it have a go at the DB. Worked a lot better than I had expected. Here's just a quick rundown for future reference (of myself and/or others):

So first save a list of installed packages in the current one with pip freeze, then move the current install to a seperate folder and then start fresh:

python -mvenv myenv
source myenv/bin/activate
pip install mezzanine psycopg2

Anything else I only let it install as part of deps to try first, then I went on and created a new mezzanine project with the same name as before:

mezzanine-project lordvan
cd lordvan
cp old/lordvan/local_settings.py lordvan/local_settings.py
./manage.py migrate

As a pleasant surprise this just migrated everything out of the box without any issues whatsoever (keep in mind my mezzanine was real old already). Next a test with

./manage.py runserver <ip:port>

And it was just working. Of course what I had forgotten was that the Mezzanine start page, so next I just copied the new templates and edited them:

mkdir templates
cd templates
cp myenv/lib64/python3.10/site-packages/mezzanine/core/templates/base.html .
cp myenv/lib64/python3.10/site-packages/mezzanine/core/templates/index.html .

Now I had my page back up and running like before. Of course I forgot the usual again which caused a HTTP error in the browser:

cp old/lordvan/apache.wsgi lordvan/
chgrp apache lordvan -R
# edit apache config if you hardcoded the pythonpath there
/etc/init.d/apache2 restart

now it worked but there was no CSS/.. of course I also (again) forgot something else:

./manage.py collectstatic

and now we are up and running again .. except for one little thing: I had an error while saving this blog post .. (which caused me to type it again): unsupported operand type(s) for +: 'frozenset' and 'list'

After looking it up and checking the source I just edited the relevant mezzanine file (myenv/lib64/python3.10/site-packages/mezzanine/utils/html.py) and changed line 113 to this:

       protocols=list(ALLOWED_PROTOCOLS) + ["tel"],

now it runs without a problem. (there is also a bug https://github.com/stephenmcd/mezzanine/pull/2059 not sure about the 2nd part there . mine works as-is now so I'm going with that for now) - some people also simply downgraded Bleach to < 6.

Just for the record here the versions before and after:

  • python 3.9.16 => 3.10.12
  • Django 1.10.8 => 4.2.2
  • Mezzanine 4.2.3 => 6.0.0
  • psycopg2 2.8.6 => 2.9.6
  • rest just up to date at time of install
Currently unrated

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

Recent Posts

Archive

2023
2022
2021
2020
2019
2018
2014
2012
2011
2010
2009
2008
2007

Categories

Authors

Feeds

RSS / Atom