Search code examples
pythondjangopostgresqldjango-migrationsapple-m1

Django can't migrate to a new db


I created a new postgreSQL database and ran "python manage.py migrate" on a Django project with no migration files. This error showed up :

django.db.utils.ProgrammingError: relation "app_model_name" does not exist

I tried makemigrations, showmigrations, runserver, and shell and it still gave me the same error. How do I fix this?

I am also using a Macbook Air with the M1 Chip.

Update: I don’t think this is caused by the M1 Chip because I was able to migrate/makemigrations in another project of mine. This is the initial error I got:

psycopg2.errors.UndefinedTable: relation "app_model_name" does not exist

Solution

  • I solved the problem by using Rosetta because this was an M1 related issue.

    arch -x86_64 python manage.py makemigrations 
    arch -x86_64 python manage.py migrate