Can't Create Super User Django

前端 未结 2 2170
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-07 10:05

I\'m assuming that it is because my superuser depends on UserProfile which has no existing data yet. My model looks like

from django.db import models
from djang         


        
2条回答
  •  眼角桃花
    2021-02-07 10:22

    On Mar 23, 2011, at 4:25 AM, Malcolm Box wrote:

    Further investigation: looks like it's a South/syncdb interaction. The UserProfile will be created by the south migration, but of course that hasn't run when the auth post_install runs to prompt for a superuser.

    Sadly syncdb --migrate doesn't do the right thing either.

    For now, I'm just creating a superuser manually using ./manage.py shell, but would welcome any ideas on how to solve this better.

    Don't create the super user during syncdb, you user profile table will not exist. You must have a create signal on admin that creates a user profile, this looks like it is failing

    The procedure you wan to use to initialize the database is:

    python manage.py syncdb --noinput
    python manage.py migrate
    python manage.py createsuperuser
    

    Reference : https://groups.google.com/forum/?fromgroups=#!topic/django-users/sBXllxrIdMc

提交回复
热议问题