dbca-wa / wastd

Western Australian Sea Turtle and Strandings Database
https://dbca-wa.github.io/wastd/
MIT License
4 stars 3 forks source link

Migrate to Python 3, Django 2 #88

Closed florianm closed 5 years ago

florianm commented 6 years ago

Fixes

Logging

URL config

Some changes to include(), e.g.

re_path(r'^api/1/', include((wastd_router.urls, 'api'), namespace="api")),

Migrations

Primary problem are stray bytestrings b""in old migrations. Solution is to remove the b prefix in those migrations.

Patch to catch them all:

vim $VIRTUAL_ENV/lib/python3.6/site-packages/django/db/models/manager.py

Import force_text and insert around the name attribute.

from django.utils.encoding import force_text

# ...

def contribute_to_class(self, model, name):
        if not self.name:
            self.name = name
        self.model = model

        setattr(model, force_text(name), ManagerDescriptor(self))

        model._meta.add_manager(self)

Dpaw-utils

vim $VIRTUAL_ENV/lib/python3.6/site-packages/dpaw_utils/middleware.py

Change request.user.is_authenticated() to request.user.is_authenticated. Fixed in git+git://github.com/dbca-wa/dpaw-utils@minimal.

Point field

Change .get_x() to .x, same for y.

florianm commented 6 years ago

remaining: logging to file (done), serve via gunicorn (see SDIS, done), add some more tests, bugfixes for UAT before rolling out to PROD.