Search code examples
pythondjangodjango-modelsdjango-migrationsdata-migration

Django - doesn`t make the migrations


In Django, after I created a model, in cmd I runned: "python manage.py makemigrations" and returned that: Migrations for 'hello': hello\migrations\0001_initial.py - Create model Article hello is the name of app. And after I runned: "python manage.py migrate" returned: Operations to perform: Apply all migrations: admin, auth, contenttypes, hello, sessions Running migrations: No migrations to apply.

And when I try to introduce a field in that model appear: OperationalError at /admin/hello/article/add/ no such table: hello_article

I tried to delete all migrations and I created again the model and the result was the same. How fix this?


Solution

  • I suggest you try deleting migration files in migration folder and then delete db.sqlite3 since model tables are stored in the database. Now run python manage.py makemigrations and finally run python manage.py migrate