{{{
# Generated by Django 3.1a1 on 2020-05-14 16:25
from django.db import migrations, models
import speedy.match.accounts.models
class Migration(migrations.Migration):
dependencies = [
('match_accounts', '0006_auto_20200121_1731'),
]
operations = [
migrations.AlterField(
model_name='siteprofile',
name='diet_match',
field=models.JSONField(default=speedy.match.accounts.models.SiteProfile.diet_match_default,
verbose_name='Diet match'),
),
migrations.AlterField(
model_name='siteprofile',
name='relationship_status_match',
field=models.JSONField(default=speedy.match.accounts.models.SiteProfile.relationship_status_match_default,
verbose_name='Relationship status match'),
),
migrations.AlterField(
model_name='siteprofile',
name='smoking_status_match',
field=models.JSONField(default=speedy.match.accounts.models.SiteProfile.smoking_status_match_default,
verbose_name='Smoking status match'),
),
]
}}}
Most of the things worked with Django 3.1a1 except a few things which I
will report later. But when trying to use Django 3.0.6 again, I ran the
following commands:
{{{
./manage_all_sites.sh migrate auth 0011
./manage_all_sites.sh migrate match_accounts 0006
}}}
Then, after running my websites with Django 3.0.6, I received an error
message:
`Incorrect padding`
I can't run my websites locally without deleting the database completely
including all users. I didn't find any way to fix the database to run it
with Django 3.0.6.
--
Ticket URL: <https://code.djangoproject.com/ticket/31592>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
Ticket URL: <https://code.djangoproject.com/ticket/31592#comment:1>
* status: new => closed
* resolution: => invalid
* component: Uncategorized => Core (Other)
Comment:
Thanks for this ticket. This error is not related with migrations but with
sessions and changes of a hashing algorithm from the SHA-1 to SHA-256:
{{{
File "django/contrib/sessions/backends/base.py", line 110, in decode
encoded_data = base64.b64decode(session_data.encode('ascii'))
File "python3.6/base64.py", line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
}}}
To fix this you need to remove sessions from cache, e.g.
{{{
from django.contrib.sessions.models import Session
Session.objects.all().delete()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31592#comment:2>
Comment (by אורי):
Does this error also occur if I migrate forward (from 3.0 to 3.1) or only
backwards?
Anyway, I think Django should be able to delete the relevant cache when
migrating (backwards or forward) and not just raise exceptions which don't
make sense to the users. Maybe just check the version of the session
objects and if it's not correct then delete them.
--
Ticket URL: <https://code.djangoproject.com/ticket/31592#comment:3>
Comment (by אורי):
Also, does it mean migrating from Django 3.0 to 3.1 will log out all the
users? I use persistent cookies for 30 years and I don't want to log out
users who didn't log out or delete their cookies.
--
Ticket URL: <https://code.djangoproject.com/ticket/31592#comment:4>
Comment (by felixxm):
Replying to [comment:3 אורי]:
> Does this error also occur if I migrate forward (from 3.0 to 3.1) ...?
>
No, support for user sessions that use the old hashing algorithm remains
until Django 4.0, see [https://docs.djangoproject.com/en/3.1/releases/3.1
/#django-contrib-auth release notes].
--
Ticket URL: <https://code.djangoproject.com/ticket/31592#comment:5>