简体   繁体   中英

Syncdb command in Django 1.6.5 does not create new model class in models.py - says table already exists

I am following a tutorial on Udemy on Django, in which the author adds a new model to models.py and runs the syncdb command to add the table to the database. I am trying to replicate this using Django 1.6.5 and MySQL 5.5. I have searched other questions and they are slightly different scenarios.

I read in the docs that you can add new models using syncdb, but you will either have to drop the existing tables or use South to migrate the data to alter an existing table. I am simply trying to add a new model, and I get the error -- the table already exists.

Could someone explain why I am getting this error, and should I just use South and avoid this situation?

Once you've created the DB, you can't simply add new models.

In order to update your schema, you'll have to use south (for migrations in Django <= 1.6), or use the built-in migrations in Django 1.7

Since you're using Django 1.6, you should read about it in http://south.readthedocs.org/en/latest/tutorial/part1.html and then use the package to migrate your schema.

Just follow the tutorial and ask on Stack Overflow if further questions rise, it shouldn't be too complicated

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM