|
楼主 |
发表于 2020-7-25 00:19:57
|
显示全部楼层
虚拟迁移报错
(ll_env) F:\learning_log>python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, learning_logs, sessions
Running migrations:
Applying learning_logs.0004_topic_owner...Traceback (most recent call last):
File "F:\learning_log\ll_env\lib\site-packages\django\db\models\fields\__init__.py", line 1772, in get
_prep_value
return int(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.datetime'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "F:\learning_log\ll_env\lib\site-packages\django\core\management\__init__.py", line 401, in execu
te_from_command_line
utility.execute()
File "F:\learning_log\ll_env\lib\site-packages\django\core\management\__init__.py", line 395, in execu
te
self.fetch_command(subcommand).run_from_argv(self.argv)
File "F:\learning_log\ll_env\lib\site-packages\django\core\management\base.py", line 328, in run_from_
argv
self.execute(*args, **cmd_options)
File "F:\learning_log\ll_env\lib\site-packages\django\core\management\base.py", line 369, in execute
output = self.handle(*args, **options)
File "F:\learning_log\ll_env\lib\site-packages\django\core\management\base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "F:\learning_log\ll_env\lib\site-packages\django\core\management\commands\migrate.py", line 231,
in handle
post_migrate_state = executor.migrate(
File "F:\learning_log\ll_env\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "F:\learning_log\ll_env\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrat
e_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "F:\learning_log\ll_env\lib\site-packages\django\db\migrations\executor.py", line 245, in apply_m
igration
state = migration.apply(state, schema_editor)
File "F:\learning_log\ll_env\lib\site-packages\django\db\migrations\migration.py", line 124, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "F:\learning_log\ll_env\lib\site-packages\django\db\migrations\operations\fields.py", line 110, i
n database_forwards
schema_editor.add_field(
File "F:\learning_log\ll_env\lib\site-packages\django\db\backends\sqlite3\schema.py", line 328, in add
_field
self._remake_table(model, create_field=field)
File "F:\learning_log\ll_env\lib\site-packages\django\db\backends\sqlite3\schema.py", line 189, in _re
make_table
self.effective_default(create_field)
File "F:\learning_log\ll_env\lib\site-packages\django\db\backends\base\schema.py", line 303, in effect
ive_default
return field.get_db_prep_save(self._effective_default(field), self.connection)
File "F:\learning_log\ll_env\lib\site-packages\django\db\models\fields\related.py", line 939, in get_d
b_prep_save
return self.target_field.get_db_prep_save(value, connection=connection)
File "F:\learning_log\ll_env\lib\site-packages\django\db\models\fields\__init__.py", line 821, in get_
db_prep_save
return self.get_db_prep_value(value, connection=connection, prepared=False)
File "F:\learning_log\ll_env\lib\site-packages\django\db\models\fields\__init__.py", line 2365, in get
_db_prep_value
value = self.get_prep_value(value)
File "F:\learning_log\ll_env\lib\site-packages\django\db\models\fields\__init__.py", line 1774, in get
_prep_value
raise e.__class__(
TypeError: Field 'id' expected a number but got datetime.datetime(2020, 7, 24, 16, 18, 30, 203285, tzinf
o=<UTC>).
打开网页 报错
|
|