Translate all files from Python 2 to Python 3

Install packages:

_$: apt-get install python3-dev

Virtualenv:

_$: virtualenv -p /usr/bin/python3 venv3
_$: source venv3/bin/activate
(venv3)_$: pip install -r requirements.txt

Suggested approach: go directory by directory running the 2to3 tool and reviewing the changes made.

_$: 2to3 -w ./application/api
_$: 2to3 -w ./application/app
_$: 2to3 -w ./application/...
_$: 2to3 -w ./application/utils
_$: 2to3 -w ./application/web/adm
_$: 2to3 -w ./application/web/pub

uWSGI

If we did a system-wide installation of uWSGI and the system is using Python 2, the uwsgi binary (/usr/local/bin/uwsgi) will use the Python version installed in the system (i.e. Python 2).

To solve this, we will install another uWSGI in the virtual environment. Since the virtual environment has Python 3, the uwsgi binary (/var/application/venv3/bin/uwsgi) will use Python 3.

(venv3)_$: pip install uwsgi

And modify the supervisor file and the INI files accordingly

supervisor:
-----------
...
command=/var/application/venv3/bin/uwsgi --ignore-sigpipe --ignore-write-errors
...
app-prod.ini:
-------------
...
virtualenv = /var/application/venv3
...