(2021-02-07) Migrating to Python3

When I hit various error messages that make no sense (see Feb07 (2020-10-12) Building user management in WikiFlux), I start to suspect the underlying mess is from still being on Python-2. So going to finally bite the bullet.

Starting on laptop from (2020-10-02) Setting Up Python On New MacBookPro....

  • in which I did pyenv install 3.8.5

Feb07'2021 setting up python3 (parallel to Oct03 notes above)

  • mkdir py3
  • pyenv local 3.8.5
  • pip install virtualenv
  • mkdir flask, cd flask, virtualenv venv
  • source venv/bin/activate
  • pip install Flask
  • cp -R py2/flask/wikiweb py3/flask/
  • cd wikiweb
  • pip install python-dotenv
  • flask run → runs!
  • hit page → No module named 'flask_sqlalchemy'
  • pip install -U Flask-SQLAlchemy
  • flask runNo module named 'flask_user'
  • pip install Flask-User, flask runInstall 'email_validator' for email validation support.
  • pip install email_validator, flask runNo module named 'forms'
  • [change](ModuleNotFoundError: No module named 'forms') from forms to from .forms → error from using print without parens (python 3 change)
  • discover 2to3, do 2to3 -w routes.py it adds a 2nd set of parens to all the print statements I just fixed myself. So back-fixed those.
  • flask runModuleNotFoundError: No module named 'werkzeug.contrib' - Werkzeug 1.0.0 has removed deprecated code from 'werkzeug.contrib'. You can downgrade to Werkzeug 0.16.0 to work around this issue. (that version was released 2019-09-19)
  • pip install feedgen, adjust code per docs
  • pip install stripe
  • run 2to3 against rest of files
  • pip install psycopg2
  • flask run - have to change URL from http://127.0.0.1:5000/ to http://flux.garden:5000/
  • hit page → No module named 'commonmark'
  • install → No module named 'pyparsing'
  • install → get home page!

Feb13

  • hit specific garden-page: nope, have to change string.count('str',x) to str.count('x')
    • ugh lots of string function tweaks in routes.py
  • most things working now
  • check atom feed... some tweaks, I hadn't done it right
  • ugh feed issue with my datetime fields: Datetime object has no timezone info
  • pip install pytz
  • plus other feed tweaks. Now working, incl checking w3 validator
  • next: check private/inner feed, think has wrong url. Fixed it, then realized I didn't want to have a feed available for a private space. Duh.
  • the Stripe stuff worked with mod.

(Feb27: I was afraid my local stuff got broken from (2021-02-18) Starting some LiveCoding but it seems ok.)

(Later Feb27: did a simple update of my linode and nothing was working. I figured out I was running flask 1.1 and chunks of my old code wouldn't work. How did that happen? After much mucking about I realized that some of what I did above I must have been doing in my server window instead of a local window, because there's a pip.log file. What a mess.

Next

  • figure out how to do the server! I guess I'll have to upgrade the python stuff and move to this new app structure all at the same time. Not ideal...
  • update: looks like before I do that I need to update my server from Ubuntu 11! Which is so old they suggest spinning up a new Linode, getting it running, copying over data, and then swapping IPs. Should I get that new node running my new system from the get-go? Seems kinda logical....
  • (2021-03-01) Massive Server Upgrade attempts with Linode, then switch to
  • (2021-04-25) Move To DigitalOcean

Edited:    |       |    Search Twitter for discussion