Earthling
Earthling

Reputation: 457

Upgrading Django from 3.2 LTS to Django 5.04 causes typeerror: requires_system_checks must be a list or tuple

I just upgraded Django from 3.2 LTS to the latest Django 5.0.4 and updated all packages as on a need basis and I get the following trace after I attempt to run the docker-compose to start my api web server :

my-api            |   File "/opt/my-api-core/manage.py", line 22, in <module>
my-api            |     execute_from_command_line(sys.argv)
my-api            |   File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
my-api            |     utility.execute()
my-api            |   File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
my-api            |     self.fetch_command(subcommand).run_from_argv(self.argv)
my-api            |   File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 275, in fetch_command
my-api            |     klass = load_command_class(app_name, subcommand)
my-api            |   File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 49, in load_command_class
my-api            |     return module.Command()
my-api            |   File "/usr/local/lib/python3.10/site-packages/django_media_fixtures/management/commands/collectmedia.py", line 35, in __init__
my-api            |     super(Command, self).__init__(*args, **kwargs)
my-api            |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 285, in __init__
my-api            |     raise TypeError("requires_system_checks must be a list or tuple.")
my-api            | TypeError: requires_system_checks must be a list or tuple.

The following is what I've attempted so far:

  1. The django-media-fixtures is what is seen in the trace so I used https://pypi.org/project/django-media-fixtures-next/ after changing it from https://pypi.org/project/django-media-fixtures/
  2. Downgraded Django up until 4.2.11 and right up until 4.1 from the present 5.0.4

However , the error persists. I do not see the need to modify site-packages itself as it doesn't seem the right way to do it. Looking for a solution to get around this. I did see other stack posts but couldn't solve it in my case.

Here are some :

Django 4.1.9 requires_system_checks issue with manage.py - is this a bug or not

how to fix "TypeError: requires_system_checks must be a list or tuple." caused by "py manage.py grpcrunserver" command?

Upvotes: 1

Views: 112

Answers (1)

Selcuk
Selcuk

Reputation: 59445

Yes, the problem is in django-media-fixtures (and django-media-fixtures-next) which are not being maintained anymore. You can fork the project on Github and use your own fork as a dependency. You will have to change this line:

    requires_system_checks = False

to

    requires_system_checks = []

in your fork.

You can then change the relevant line in your requirements.txt to:

django-media-fixtures @ git+https://github.com/<your username>/django-media-fixtures

Upvotes: 1

Related Questions