[Fixed]-Django 1.8.3 Running test fails on database creation

1๐Ÿ‘

โœ…

You have a model in an app without migrations, with a foreign key to auth.User. As noted in the docs:

Be aware, however, that unmigrated apps cannot depend on migrated apps, by the very nature of not having migrations. This means that it is not generally possible to have an unmigrated app have a ForeignKey or ManyToManyField to a migrated app; some cases may work, but it will eventually fail.

You have to add migrations for the app with a foreign key to your user model.

0๐Ÿ‘

Try doing the below commands first:

$ python manage.py makemigrations
$ python manage.py migrate
$ python manage.py syncdb

If you make any changes to your model definitions in models.py you have to run SQL migration queries to move your database to your new model.

Leave a comment