You are trying to add a non-nullable field 'new_field' to userprofile without a default

前端 未结 16 1338
北恋
北恋 2020-11-30 19:27

I know that from Django 1.7 I don\'t need to use South or any other migration system, so I am just using simple command python manage.py makemigrations

16条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 20:20

    If you are in early development cycle and don't care about your current database data you can just remove it and then migrate. But first you need to clean migrations dir and remove its rows from table (django_migrations)

    rm  your_app/migrations/*
    
    rm db.sqlite3
    python manage.py makemigrations
    python manage.py migrate
    

提交回复
热议问题