django-split-settings icon indicating copy to clipboard operation
django-split-settings copied to clipboard

IsADirectoryError with condition in optional include

Open SukiCZ opened this issue 1 year ago • 0 comments

I have a settings like this

from os import environ

from split_settings.tools import optional, include

ENV = environ.get('ENV', 'local')

include(
    'components/base.py',
    'components/database.py',
    optional('local_settings.py' if ENV == 'local' else None),
)

When I try to run my django app I get an error

  File "/app/config/settings/__init__.py", line 55, in <module>
    include(
  File "/usr/local/lib/python3.11/site-packages/split_settings/tools.py", line 107, in include
    with open(included_file, 'rb') as to_compile:
         ^^^^^^^^^^^^^^^^^^^^^^^^^
IsADirectoryError: [Errno 21] Is a directory: '/app/config/settings'

I tried to fix this error in #510 but the PR is just being ignored. We can't upgrade django-split-settings from version 1.2.0 to newer

SukiCZ avatar Jul 02 '24 18:07 SukiCZ