Skip to content

Fails with tuples in STATICFILES_DIRS #118

@jasalt

Description

@jasalt

Having following in settings.py makes it fail on startup:

# https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
STATICFILES_DIRS = [BASE_DIR / "static",
                    ("bootstrap_scss", BASE_DIR / "node_modules/bootstrap/scss"),
                    ("glide", BASE_DIR / "node_modules/@glidejs/glide/dist")]

Emacs Eglot LSP client says that connection was successful but none of the functionality works.

Output of the Eglot LSP events buffer reveals the issue:

[stderr]  Traceback (most recent call last):
[stderr]    File "/home/user/dev/project/test-django/.venv/lib/python3.13/site-packages/djlsp/scripts/django-collector.py", line 636, in <module>
[stderr]      collector.collect()
[stderr]      ~~~~~~~~~~~~~~~~~^^
[stderr]    File "/home/user/dev/project/test-django/.venv/lib/python3.13/site-packages/djlsp/scripts/django-collector.py", line 201, in collect
[stderr]      self.file_watcher_globs = self.get_file_watcher_globs()
[stderr]                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
[stderr]    File "/home/user/dev/project/test-django/.venv/lib/python3.13/site-packages/djlsp/scripts/django-collector.py", line 265, in get_file_watcher_globs
[stderr]      static_folder = os.path.basename(static_path)
[stderr]    File "<frozen posixpath>", line 168, in basename
[stderr]  TypeError: expected str, bytes or os.PathLike object, not tuple
[stderr]  Collector failed with:
[stderr]  Traceback (most recent call last):
[stderr]    File "/home/user/dev/project/test-django/.venv/lib/python3.13/site-packages/djlsp/server.py", line 318, in _get_django_data_from_python_path
[stderr]      return json.loads(subprocess.check_output(command).decode())
[stderr]                        ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
[stderr]    File "/usr/lib/python3.13/subprocess.py", line 472, in check_output
[stderr]      return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
[stderr]             ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[stderr]                 **kwargs).stdout
[stderr]                 ^^^^^^^^^
[stderr]    File "/usr/lib/python3.13/subprocess.py", line 577, in run
[stderr]      raise CalledProcessError(retcode, process.args,
[stderr]                               output=stdout, stderr=stderr)
[stderr]  subprocess.CalledProcessError: Command '['/home/user/dev/project/test-django/.venv/bin/python', '/home/user/dev/project/test-django/.venv/lib/python3.13/site-packages/djlsp/scripts/django-collector.py', '--project-src=/home/user/dev/project/test-django']' returned non-zero exit status 1.
[stderr]  Ignoring notification for unknown method "workspace/didChangeConfiguration"

After removing the tuples from STATICFILES_DIRS it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions