问题
I'm trying to deploy my project on heroku ,i'm using django 3.1 and i'm unable to do that. I'm getting error due to migrations. Please i humble request you to give some time to this question to resolve this problem. Whenever i run the command heroku run python manage.py migrate ,it gives following traceback.
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 "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 85, in wrapped
res = handle_func(*args, **kwargs)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 92, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/executor.py", line 18, in __init__
self.loader = MigrationLoader(self.connection)
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/loader.py", line 53, in __init__
self.build_graph()
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/loader.py", line 255, in build_graph
self.graph.validate_consistency()
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/graph.py", line 195, in validate_consistency
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/graph.py", line 195, in <listcomp>
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "/app/.heroku/python/lib/python3.6/site-packages/django/db/migrations/graph.py", line 58, in raise_error
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration accounts.0001_initial dependencies reference nonexistent parent node ('auth', '0023_remove_user_current_balance')
migration dependency
dependencies = [
('auth', '0023_remove_user_current_balance'),
]
account.model
GENDER_CHOICES = (
('male','Male'),
('female','Female'),
)
class User(auth.models.AbstractUser):
current_balance = models.IntegerField(("user balance"),default=0, blank=True, null=True)
age = models.IntegerField(("age"),blank=True, null=True)
gender = models.CharField(("gender"), max_length=50,choices=GENDER_CHOICES,null=True)
nationality = models.CharField(("nationality"), max_length=50,null=True)
def __str__(self):
return "@{}".format(self.username)
When i tried to comment out the dependency , Then it returned me : raise ValueError('Related model %r cannot be resolved' % self.remote_field.model)ValueError: Related model 'auth.Group' cannot be resolved
if more code is require then tell me in a comment section thank you.
来源:https://stackoverflow.com/questions/65742988/django-db-migrations-exceptions-nodenotfounderror-migration-accounts-0001-initi