ERROR 1146 DJANGO没有自动创建对应表
eclipse 4.4
python 2.7
django 1.10
mysql 5.7
1、我在finnews数据库下建了finnews表格,
2、django正常运行创建了finnews_finnews表格,
3、但是由于一些别的原因,admin中无法编辑和打开finnewss表格,于是我把finnews表格和finnews_finnews表格都删了,
4、再重新migrate,可是始终无法创建finnews_finnews表格,
日志如下
D:\showwho\mysite>python manage.py makemigrations
Migrations for 'FinNews':
FinNews\migrations\0002_auto_20161111_0904.py:
- Alter field id on finnews
- Alter field shijian on finnews
- Alter field xinwen on finnews
D:\showwho\mysite>python manage.py migrate
Operations to perform:
Apply all migrations: FinNews, admin, auth, contenttypes, sessions
Running migrations:
Applying FinNews.0002_auto_20161111_0904...Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "D:\Python27\lib\site-packages\django\core\management\__init__.py", line 367, in execute_from_command_line
utility.execute()
File "D:\Python27\lib\site-packages\django\core\management\__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\Python27\lib\site-packages\django\core\management\base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "D:\Python27\lib\site-packages\django\core\management\base.py", line 345, in execute
output = self.handle(*args, **options)
File "D:\Python27\lib\site-packages\django\core\management\commands\migrate.py", line 204, in handle
fake_initial=fake_initial,
File "D:\Python27\lib\site-packages\django\db\migrations\executor.py", line 115, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "D:\Python27\lib\site-packages\django\db\migrations\executor.py", line 145, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "D:\Python27\lib\site-packages\django\db\migrations\executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "D:\Python27\lib\site-packages\django\db\migrations\migration.py", line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "D:\Python27\lib\site-packages\django\db\migrations\operations\fields.py", line 204, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "D:\Python27\lib\site-packages\django\db\backends\base\schema.py", line 495, in alter_field
old_db_params, new_db_params, strict)
File "D:\Python27\lib\site-packages\django\db\backends\base\schema.py", line 683, in _alter_field
self.execute(self._create_index_sql(model, [new_field], suffix="_uniq"))
File "D:\Python27\lib\site-packages\django\db\backends\base\schema.py", line 112, in execute
cursor.execute(sql, params)
File "D:\Python27\lib\site-packages\django\db\backends\utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "D:\Python27\lib\site-packages\django\db\backends\utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "D:\Python27\lib\site-packages\django\db\utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "D:\Python27\lib\site-packages\django\db\backends\utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "D:\Python27\lib\site-packages\django\db\backends\mysql\base.py", line 110, in execute
return self.cursor.execute(query, args)
File "D:\Python27\lib\site-packages\pymysql\cursors.py", line 166, in execute
result = self._query(query)
File "D:\Python27\lib\site-packages\pymysql\cursors.py", line 322, in _query
conn.query(q)
File "D:\Python27\lib\site-packages\pymysql\connections.py", line 835, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "D:\Python27\lib\site-packages\pymysql\connections.py", line 1019, in _read_query_result
result.read()
File "D:\Python27\lib\site-packages\pymysql\connections.py", line 1302, in read
first_packet = self.connection._read_packet()
File "D:\Python27\lib\site-packages\pymysql\connections.py", line 981, in _read_packet
packet.check_error()
File "D:\Python27\lib\site-packages\pymysql\connections.py", line 393, in check_error
err.raise_mysql_exception(self._data)
File "D:\Python27\lib\site-packages\pymysql\err.py", line 107, in raise_mysql_exception
raise errorclass(errno, errval)
django.db.utils.ProgrammingError: (1146, u"Table 'finnews.finnews_finnews' doesn't exist")