Problem orientation
Developed in Django framework, a user table is defined to replace the user table automatically generated by the framework, which appears when the migrate
command is executed to synchronize the database. Details of the error are as follows
E:\SweetYaya\MyProj01> python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "D:\Program Files\Python36\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
utility.execute()
File "D:\Program Files\Python36\lib\site-packages\django\core\management\__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\Program Files\Python36\lib\site-packages\django\core\management\base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "D:\Program Files\Python36\lib\site-packages\django\core\management\base.py", line 398, in execute
output = self.handle(*args, **options)
File "D:\Program Files\Python36\lib\site-packages\django\core\management\base.py", line 89, in wrapped
res = handle_func(*args, **kwargs)
File "D:\Program Files\Python36\lib\site-packages\django\core\management\commands\migrate.py", line 95, in handle
executor.loader.check_consistent_history(connection)
File "D:\Program Files\Python36\lib\site-packages\django\db\migrations\loader.py", line 310, in check_consistent_history
connection.alias,
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency MyApp.0001_initial on database 'default'.
terms of settlement
Method 1
delete database mark>, delete all Auth in the database_ Code> and
Django_ Code> and re execute it. It's rough. It's not good.
Method 2
First makemigrations
Open settings. Py
and comment out install_ In apps,
'django. Contrib. Admin ',
Open URLs. Py
, comment out the admin in urlpatterns, and then migrate
will not report an error. Finally, pay attention to recover the comment content
Read More:
- ValueError: The field admin.LogEntry.user was declared with a lazy reference to ‘MyApp.sysusers‘
- DM database data migration DTS error solution
- Built on Ethereum, puppeth cannot be used to create the initial block, and an error is reported Fatal: Failed to write genesis block: unsupported fork ordering: eip15
- error: ‘for‘ loop initial declarations are only allowed in C99 mode
- maven Error occurred during initialization of VM Too small initial heap
- Compiler problem, error: ‘for’ loop initial declarations are only allowed in C99 mode
- How to Fix error: ‘for’ loop initial declarations are only allowed in C99 mode
- Solution: Solving Environment: failed with initial frozen solve. Retrying with flexible solve
- Solving environment: failed with initial frozen solve. Retrying with flexible solve.错误
- [Solved] Dev-C++ [Error] ‘for‘ loop initial declarations are only allowed in C99 or C11 mode
- Error: missing initial data partition file virtual machine runtime error resolution
- ERROR: Missing initial data partition file virtual machine runtime error solution
- STOP: c000021a { Fatal System Error } the initial session process or system process terminated …
- Xfce4 restores the panel to its default value
- yum install/update error: sqlite3.DatabaseError: database disk image is malformed
- Prompt “XXX is” when debugging real machine busy:Processing symbol Files “and” Xcode will continue when XXX is finished“
- An error is reported when kettle connects Oracle database and MySQL database
- When Python Django creates a database, can’t open file ‘ manage.py ‘: [Errno 2] No such file or directory
- django.db.utils.OperationalError: no such table: django_admin_log
- mysql workbench Error Code: 1046. No database selected Select the default DB to be used