Django Programming error column does not exist even after running migrations

前端 未结 9 1025
南旧
南旧 2020-12-08 20:54

I run python manage.py makemigrations and I get: No changes detected Then, python manage.py migrate and I get: No migrations to apply.

9条回答
  •  轮回少年
    2020-12-08 21:24

    When I get this error, my extreme way to solve it is to reset my database:

    1. Reset your database

    For Postgresql on Heroku:

    Heroku > your_app > Resources > database > add-ons > click on your database and open it

    For postgresql

    settings > Reset database

    1. Delete all files in your_app > migrations > __pycache__ except __init.py__
    2. Delete all files in your_app > migrations except __pycache__ folder and __init.py__
    3. Then run:

      python manage.py makemigrations

      python manage.py migrate

      python manage.py createsuperuser

    type in to create your superuser, then run:

    python manage.py makemigrations
    
    python manage.py migrate
    
    python manage.py 
    

    If you are able to inspect your models from your admin section, then it should be all okay now.

提交回复
热议问题