﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31738	"invalid exception thrown ""django.core.exceptions.ImproperlyConfigured: settings.FIXTURE_DIRS contains duplicates."""	timharsch	nobody	"loaddata.py incorrectly throws an ImproperlyConfigured exception when FIXTURE_DIRS is a list of one.  See:
https://github.com/django/django/blame/798835112d81b852efaae0e067af389c733cd1b3/django/core/management/commands/loaddata.py#L296

I changed this code to:
{{{
286         print(fixture_dirs)
287         print(len(fixture_dirs))
288         print(len(set(fixture_dirs)))
289         if len(fixture_dirs) != len(set(fixture_dirs)):
290             raise ImproperlyConfigured(""settings.FIXTURE_DIRS contains duplicates."")
}}}
and set my FIXTURE_DIRS like so: `FIXTURE_DIRS=('piece/core/fixtures','piece/core/fixtures2')`

when I run loaddata I see:
{{{
('piece/core/fixtures', 'piece/core/fixtures2')
2
2
Installed 6 object(s) from 2 fixture(s)
}}}
so far so good.  Now set it like so: `FIXTURE_DIRS=('piece/core/fixtures'')`

I run it and get:
{{{{
piece/core/fixtures
19
12
Traceback (most recent call last):
  File ""manage.py"", line 16, in <module>
    execute_from_command_line(sys.argv)
  File ""/Users/harsch/.pyenv/versions/p38/lib/python3.8/site-packages/django/core/management/__init__.py"", line 401, in execute_from_command_line
    utility.execute()
  File ""/Users/harsch/.pyenv/versions/p38/lib/python3.8/site-packages/django/core/management/__init__.py"", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File ""/Users/harsch/.pyenv/versions/p38/lib/python3.8/site-packages/django/core/management/base.py"", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File ""/Users/harsch/.pyenv/versions/p38/lib/python3.8/site-packages/django/core/management/base.py"", line 369, in execute
    output = self.handle(*args, **options)
  File ""/Users/harsch/.pyenv/versions/p38/lib/python3.8/site-packages/django/core/management/commands/loaddata.py"", line 72, in handle
    self.loaddata(fixture_labels)
  File ""/Users/harsch/.pyenv/versions/p38/lib/python3.8/site-packages/django/core/management/commands/loaddata.py"", line 106, in loaddata
    if self.find_fixtures(fixture_label):
  File ""/Users/harsch/.pyenv/versions/p38/lib/python3.8/site-packages/django/core/management/commands/loaddata.py"", line 235, in find_fixtures
    fixture_dirs = self.fixture_dirs
  File ""/Users/harsch/.pyenv/versions/p38/lib/python3.8/site-packages/django/utils/functional.py"", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File ""/Users/harsch/.pyenv/versions/p38/lib/python3.8/site-packages/django/core/management/commands/loaddata.py"", line 290, in fixture_dirs
    raise ImproperlyConfigured(""settings.FIXTURE_DIRS contains duplicates."")
django.core.exceptions.ImproperlyConfigured: settings.FIXTURE_DIRS contains duplicates.
}}}}"	Uncategorized	closed	Core (Management commands)	dev	Normal	invalid			Unreviewed	0	0	0	0	0	0
