title: Django Admin keep logout repeatedly. May because the DB is damaged. How to fix this situation?
body: <p>Let me describe how this problem Admin logout problem occurred.</p>
  <p>It was about few months ago. My DB is MSSQL.</p>
  <p>I was using Django 1.11, and I wish to update to Django 3.x .</p>
  <p>First I was updating my Django to 3.1, because of that,</p>
  <p>I have to switch django-pyodbc-azure to django-mssql-backend.</p>
  <p>And I did migrate after I update my Django to 3.1.</p>
  <p>But I didn't know that mssql-backend does not supporting Django 3.1.</p>
  <p>So I switch my Django from 3.1 to 3.0.x</p>
  <p>And I remember that I have to migrate again.</p>
  <p>But my own models' migrations are the same.</p>
  <p>I didn't add any new migrations in my models.</p>
  <p>So the Django has create some migrations that does not belong to me,</p>
  <p>and also unreachable for me.</p>
  <p>I realized Django has create some migrations after I did migrate.</p>
  <p>The migrate applies something like:</p>
  <p>admin. {nums}_logentry_add_action_flag_choices</p>
  <p>auth. {nums}_alter_user_last_name_max_length</p>
  <p>auth. {nums}_alter_group_name_max_length</p>
  <p>auth.{nums}_update_proxy_permissions</p>
  <p>member.{nums}_auto_YYYYMMDD_HHMM.py
  - (something with Change managers on membergroup)</p>
  <p>At this moment. I haven't login through Admin page.</p>
  <p>And I think I did more Django version changes after this (maybe two times again).</p>
  <p>Just because I was trying to find out which version is suit for me.</p>
  <p>After all this changing between 3.1 and 3.0,</p>
  <p>my docker is not compatible with my server and DB,</p>
  <p>And the Admin logout problem showed up.</p>
  <p>So I have to rewind my Django back to 1.11.</p>
  <p>And of course, some of the migrate I mentioned up there,</p>
  <p>have to be done again.</p>
  <p>So I don't really remember how many times I migrate before I found out the Admin logout problem.</p>
  <p>Anyway, I think I messed up something during the migrates.</p>
  <p>And it doesn't matter which Version of Django I use,</p>
  <p>3.0.x ~ 3.1.x all have the same Admin logout problem when I connect to the DB.</p>
  <p>Only when I switched back to Django 1.11, the Admin logout problem will disappear.</p>
  <p><strong>Why I think the Database is damaged?</strong></p>
  <p>Because I create a new docker image that has Django 3.0.</p>
  <p>And I create a whole new MSSQL DB, same migrations, the Django Admin works fine.</p>
  <p>But if I use the same docker container. Connect to the old Database, then Django Admin starting to have the logout problem.</p>
  <p>At the first I did think it was Django's problem, I tried some method. But none of them can solve the problem.</p>
  <p>I can't remember all of them, but for example:</p>
  <p><a href="https://groups.google.com/g/django-users/c/F9XCiLDbkbY?pli=1" rel="nofollow noreferrer">https://groups.google.com/g/django-users/c/F9XCiLDbkbY?pli=1</a></p>
  <p><a href="https://stackoverflow.com/questions/18247190/django-development-server-keeps-logging-out">Django development server keeps logging out</a></p>
  <p>My Admin logout problem also have the 302 status code.
  <a href="https://i.stack.imgur.com/ksPDK.png" rel="nofollow noreferrer">302 status code, when I browsing in the Admin and got logout.</a>
  Just like the article on google.</p>
  <p>Because the old DB, is a customer's Database, I can't tell them I damaged their DB,</p>
  <p>and ask them to move all the Data to a new created DB.</p>
  <p>Even I could ask the customer to do that, I still not sure after the Data moved to the new DB,</p>
  <p>this Admin problem will not show up again.</p>
  <p>So I would like to ask for help.</p>
  <ol>
  <li>Is there anyway to redo all the migrate for a DB, but without losing Data?</li>
  <li>Is there any method I still can try?</li>
  </ol>