Cause: The model (that is, Class) that is configured under the models.py configuration under the Django project is not created as a corresponding table.
What's going on here?
First, the models.py inside the model is created as the corresponding database table execution command (DOS command) is: manage.py syncdb.
But when I execute the command on my own computer, it is displayed. Unknown command:syncdb. Execute, manage.py help did not find this sub-command. Finally, the online search found that the command has been canceled in the Django1.9. And StackOverflow inside said can be replaced with migrate command. But the previous execution of manage.py migrate did not help me create the model corresponding table in the database.
Recommendations: 1. Django changed to a low-point version.
2.ProgrammingError or Operationalerror is a MySQL (database) operation error. If you report such a mistake in Django. The former should be the action table when the corresponding table was not found. The latter is generally a problem with the created table. Of course, it should be no problem to create a table from SYNCDB. But if you create it yourself. There may be a problem. For example, the name of the table is wrong (the model name may be uppercase, but the table names are converted to lowercase), or a default ID is not added as the primary key. Because DJangoa model that does not explicitly define a primary key variable will be assigned aIDproperty.If you want to have more control of the primary key, just specify it on a variable on the modelprimary_key=trueThis variable will take the place ofID (At thisIDwill be ignored .).
Django operation model, error: Attributeerror: ' Programmingerror ' object has no attribute ' __traceback__ '