简体   繁体   中英

Why is Django having trouble accessing my User table?

I am new to Django and web development in general. I am trying to test my app, recipe_book, using the admin page.

When try to login at http://127.0.0.1:8000/admin , I get the following error:

no such table: recipe_book_user

I have a model class named "User", defined below:

from django.contrib.auth.models import AbstractUser

class User(AbstractUser):
    pass

I then successfully made migrations and migrated the changes.

To resolve this issue, I've tried registering the User class in admin.py , with no success. I've also tried following the steps to reset the database in the following question:

Django - no such table exception

Does anyone know how I can resolve this?

I resolved this - it turns out that my migrations weren't being created. I had been typing python manage.py makemigrations instead of python manage.py [app_name] in my initial migration. Problem solved!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM