DatabaseError: relation "authtoken_token" does not exist · Issue #705 · encode/django-rest-framework (original) (raw)

Versions:

INSTALLED_APPS:
'rest_framework',

I get the following DatabaseError when trying to delete a user (i use a custom user model) in Django Admin:
DatabaseError: relation "authtoken_token" does not exist
LINE 1: ..."."is_active", "accounts_user"."date_joined" FROM "authtoken...

Sqlite does not raise an error. Using the postgresql_psycopg2 backend does.

A quick search got me to the following issue http://stackoverflow.com/questions/15160315/how-to-disable-importing-authtoken-models-when-using-sessionauthentication-with that describes a similar behaviour.

Adding rest_framework.authtoken to INSTALLED_APPS and migrating to authtoken:0001_initial solved the problem for me, although i never intended to use rest_framework.authtoken.

I dont know yet what exactly is causing the problem, but maybe this information helps to narrow down the issue.