由于本人是菜鸟,在已经生成了models.py中表的情况下,更改了modes.py中的表,但是syncdb不起作用报错。
于是我用了个死方法,登录MySQl手动把表删了,也删了应用中migrations文件夹,然后再进行 makemigrations , migrate 和 syncdb,但是去mysql中查看并没有创建相应的表。
后台登录显示:
ProgrammingError at /admin/home/article/
(1146, "Table 'alwme_db.home_article' doesn't exist")
(alwme)zhg@hang:~/alwme/alwme$ python manage.py makemigrations home
Migrations for 'home':
0001_initial.py:
- Create model Article
(alwme)zhg@hang:~/alwme/alwme$ python manage.py migrate
Operations to perform:
Apply all migrations: admin, home, contenttypes, auth, sessions
Running migrations:
No migrations to apply.
(alwme)zhg@hang:~/alwme/alwme$ python manage.py syncdb
Operations to perform:
Apply all migrations: admin, home, contenttypes, auth, sessions
Running migrations:
No migrations to apply.