Operations to perform:
Apply all migrations: admin, auth, contenttypes, mainapp, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0001_initial... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying mainapp.0001_initial...Traceback (most recent call last):
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\mysql\base.py", line 75, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
db.query(q)
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\MySQLdb\connections.py", line 255, in query
_mysql.connection.query(self, query)
MySQLdb.OperationalError: (1824, "Failed to open the referenced table 'auth_group'")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\bankingproject\manage.py", line 22, in <module>
main()
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\bankingproject\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
utility.execute()
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\core\management\__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\core\management\base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\core\management\base.py", line 458, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\core\management\base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\core\management\commands\migrate.py", line 356, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\migrations\executor.py", line 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\migrations\executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\migrations\executor.py", line 249, in apply_migration
with self.connection.schema_editor(
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\base\schema.py", line 166, in __exit__
self.execute(sql)
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\base\schema.py", line 201, in execute
cursor.execute(sql, params)
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\utils.py", line 102, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\utils.py", line 67, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\django\db\backends\mysql\base.py", line 75, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
db.query(q)
File "C:\Users\CHETA BIZ\Desktop\Richies-Project\Project-manage\Lib\site-packages\MySQLdb\connections.py", line 255, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1824, "Failed to open the referenced table 'auth_group'")
i got this error when am trying to run migrations in my django project development can anyone help me on this honestly i have been battling with this for the pass few days, in my project i have 2 apps but the first app have the custom user model and as per the database the structure looks like this in the settings for example,
DATABASES = {
'default': {},
'auth_db': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'Migration errro',
'USER': 'root',
'PASSWORD': ''Django Migration errro',
'HOST': 'localhost',
'PORT': '',
},
'first_app_db': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'second_app',
'USER': 'root',
'PASSWORD': ''Django Migration errro',
'HOST': 'localhost',
'PORT': '',
},
'second_app_db': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'second_app',
'USER': 'root',
'PASSWORD': 'Django Migration error',
'HOST': 'localhost',
'PORT': '',
},
}
honestly everything in my project looks correct including the database router, when i run makemigrations for the both app it runs successful and correctly but when i tried to run migrations for the Django auth, contenttype, seasons and admin it throw this error,
packages\MySQLdb\connections.py", line 255, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1824, "Failed to open the referenced table 'Customusermodel'")
and when i also try to run migration for the first app that have the custom user model it also throw an error,
packages\MySQLdb\connections.py", line 255, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1824, "Failed to open the referenced table 'auth_group'")
please can some help me out on how i can solve this error