Reputation: 891
In my django application, I used to authenticate users exploiting base django rest framework authentication token. Now I've switched to Json Web Token, but browsing my psql database, I've noticed the table authtoken_token, which was used to store the DRF authentication token, is still there. I'm wondering how to get rid of it. I've thought about 2 options:
I must clarify I've already removed rest_framework.authtoken from my INSTALLED_APPS
Upvotes: 3
Views: 2038
Reputation: 1361
To remove the authtoken tables you may use django's migration command in the following way:
python manage.py migrate authtoken zero
This will revert all the migrations from the authtoken app, effectively removing the tables from the database (as long as this doesn't break any constraints).
The zero migration can be used with any installed django app (see relevant django documentation).
After running the zero migration, you may remove the app from INSTALLED_APPS
Upvotes: 2
Reputation: 464
You can choose the first option. There are 3 steps should you do to complete uninstall authtoken
from your Django app
rest_framework.authtoken
from INSTALLED_APPS
, this action will tell your Django app to do not take any migrations file from that moduleauthtoken_token
table, if you willauthtoken
app name in table django_migrations
, you can remove it.Note: There are several error occurs in your code, because authtoken
module is removed from your INSTALLED_APPS
. My advice, backup your existing database first before you do above step
Upvotes: 1