Home > other >  Django python manage. Py migrate after an error, not the table
Django python manage. Py migrate after an error, not the table

Time:05-12

Python manage. Py migrate after an error ValueError: Field 'total' expected a number but got a 'total'. Can't locate problem, because there is no total this Field,



The System check identified some issues:

WARNINGS:
? : (mysql. W002) MariaDB Strict Mode is not set for the database connection 'default'
HINT: MariaDB 's Strict Mode fixes many data integrity problems in MariaDB, to as data truncation upon insertion, by escalating warnings into errors. It is strongly It you activate It. See: https://docs.djangoproject.com/en/3.1
/ref/databases/# mysql - SQL - mode
Operations to perform:
Apply all migrations: admin, auth, contenttypes firstapp, sessions
Running migrations:
Applying firstapp. 0007 _where_total... Traceback (the most recent call last) :
The File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ db \ models \ fields \ set py", line 1774, in get_prep_value
Return int (value)
ValueError: invalid literal for the int () with base 10: 'total'

The above exception was The direct cause of The following exception:

Traceback (the most recent call last) :
The File "is the manage. Py", line 21, in & lt; module>
The main ()
The File "is the manage. Py", line 17, in the main
Execute_from_command_line (sys. Argv)
File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django/core/management/set py", line 401, in execute_from_command_line
The utility. The execute ()
File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django/core/management/set py", line 395, in the execute
Self. Fetch_command (subcommand). Run_from_argv (self. Argv)
File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ core \ management \ base py", line 330, in run_from_argv
The self. The execute (* args, * * cmd_options)
File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ core \ management \ base py", line 371, in the execute
The output=self. Handle (* args, * * options)
File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ core \ management \ base py", line 85, wrapped in
Res=handle_func (* args, * * kwargs)
File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django/core/management/commands \ migrate py", line 243, handle in
Post_migrate_state=executor. Migrate (
The File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ db \ migrations \ executor py", line 117, migrate in
State=self. _migrate_all_forwards (the state plan, full_plan, fake=fake, fake_initial=fake_initial)
The File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ db \ migrations \ executor py", line 147, in _migrate_all_forwards
State=self. Apply_migration (state, migration, fake=fake, fake_initial=fake_initial)
The File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ db \ migrations \ executor py", line 227, in apply_migration
State=migration. Apply (state, schema_editor)
The File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ db \ migrations \ migration py", line 124, in the apply
Operation. Database_forwards (self) app_label schema_editor, old_state, project_state)
The File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ db \ migrations \ operations \ fields py", line 104, in database_forwards
Schema_editor. Add_field (
The File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ db \ backends \ mysql \ schema py", line 89, in add_field
Super (). Add_field (model, field)
The File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ db \ backends \ base \ schema py", line 455, in add_field
Definition, params=self. Column_sql (model, field, include_default=True)
The File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ db \ backends \ base \ schema py", line 223, in column_sql
Default_value (field)
=https://bbs.csdn.net/topics/self.effective_defaultThe File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ db \ backends \ base \ schema py", line 303, in effective_default
Return field. Get_db_prep_save (self. _effective_default (field), the self. The connection)
The File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ db \ models \ fields \ set py", line 823, in get_db_prep_save
Return the self. Get_db_prep_value (value, connection=connection, prepared=False)
The File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ db \ models \ fields \ set py", line 818, in get_db_prep_value
Value=https://bbs.csdn.net/topics/self.get_prep_value (value)
The File "C: \ Users \ hughw \ Desktop \ hospitalmanagement - master \ venv \ lib \ site - packages \ django \ db \ models \ fields \ set py", line 1776, in get_prep_value
Raise e. magic __class__ (
null
  • Related