Changing models in django leads to a broken database?

I added and removed the fields in the models.py file, and then ran manage.py syncdb. Usually I have to exit the shell and reload it before syncdb does anything. And then even after that, I get errors when trying to access the admin pages, it seems that some of the new fields that I added are still not showing up in the model:

Caught an exception while rendering: no such column: mySite_book.Title
+3
source share
3 answers

Django does not perform database migration for you, that is, if you add new fields, Django will not modify your database schema.

You can:

  • , . , .
  • , South, (, hibernate script).
  • / .
+9

( ), test.db . /manage.py syncdb. ...

+4

Source: https://habr.com/ru/post/1739690/


All Articles