1π
I solved it, but it was a silly issue. First, when running python manage.py makemigrations
for the first time, you should specify which app youβre migrating for β so I used python manage.py makemigrations myapp
. Secondly, the way Iβve set up my project, manage.py
uses the dev settings by default, and this was writing to an SQLite database. I added the --settings=core.settings.production
flag, and it worked.
2π
You can try these steps to see if it resolves your problem:
- delete all the migration files for your app, as well as the database records for the app migrations in the
django_migrations
table. - Run:
python manage.py makemigrations <appname>
- Run:
python manage.py migrate <appname>
In addition to the above you can try adding to each of your model classes the meta class setting managed = True
and app_label = <name of your app>
i.e.
class Food(models.Model):
class Meta:
app_label = "food"
managed = True
The rest of your class as you had it. Of course add this Meta for all your models. Make sure the app_label
is lower case like you have it in the INSTALLED_APPS
setting.