Using selenium I get some errors: TypeError: expected str, bytes or os.PathLike object, not NoneType

When I run a test case

python3.9 manage.py test

in django webapp I get some errors.

System check identified no issues (0 silenced).
test_login (pygiustizia.tests.test_views_topics.ViewsTopicsTestCase) ... nel costruttore model Users
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
  File "/usr/lib/python3.9/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/home/nicola/.local/lib/python3.9/site-packages/django/test/testcases.py", line 1662, in __call__
    return super().__call__(environ, start_response)
Traceback (most recent call last):
  File "/usr/lib/python3.9/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/lib/python3.9/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/home/nicola/.local/lib/python3.9/site-packages/django/test/testcases.py", line 1662, in __call__
    return super().__call__(environ, start_response)
  File "/home/nicola/.local/lib/python3.9/site-packages/django/core/handlers/wsgi.py", line 132, in __call__
    response = self.get_response(request)
  File "/home/nicola/.local/lib/python3.9/site-packages/django/test/testcases.py", line 1662, in __call__
    return super().__call__(environ, start_response)
  File "/home/nicola/.local/lib/python3.9/site-packages/django/core/handlers/wsgi.py", line 132, in __call__
    response = self.get_response(request)
  File "/home/nicola/.local/lib/python3.9/site-packages/django/test/testcases.py", line 1645, in get_response
    return self.serve(request)
  File "/usr/lib/python3.9/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/home/nicola/.local/lib/python3.9/site-packages/django/core/handlers/wsgi.py", line 132, in __call__
    response = self.get_response(request)
  File "/home/nicola/.local/lib/python3.9/site-packages/django/test/testcases.py", line 1645, in get_response
    return self.serve(request)
  File "/home/nicola/.local/lib/python3.9/site-packages/django/test/testcases.py", line 1657, in serve
    return serve(request, final_rel_path, document_root=self.get_base_dir())
  File "/home/nicola/.local/lib/python3.9/site-packages/django/test/testcases.py", line 1657, in serve
    return serve(request, final_rel_path, document_root=self.get_base_dir())
  File "/home/nicola/.local/lib/python3.9/site-packages/django/test/testcases.py", line 1645, in get_response
    return self.serve(request)
  File "/home/nicola/.local/lib/python3.9/site-packages/django/test/testcases.py", line 1657, in serve
    return serve(request, final_rel_path, document_root=self.get_base_dir())
  File "/home/nicola/.local/lib/python3.9/site-packages/django/views/static.py", line 35, in serve
    fullpath = Path(safe_join(document_root, path))
  File "/home/nicola/.local/lib/python3.9/site-packages/django/utils/_os.py", line 17, in safe_join
    final_path = abspath(join(base, *paths))
  File "/home/nicola/.local/lib/python3.9/site-packages/django/views/static.py", line 35, in serve
    fullpath = Path(safe_join(document_root, path))
  File "/home/nicola/.local/lib/python3.9/site-packages/django/views/static.py", line 35, in serve
    fullpath = Path(safe_join(document_root, path))
  File "/home/nicola/.local/lib/python3.9/site-packages/django/utils/_os.py", line 17, in safe_join
    final_path = abspath(join(base, *paths))
  File "/usr/lib/python3.9/posixpath.py", line 76, in join
    a = os.fspath(a)
  File "/home/nicola/.local/lib/python3.9/site-packages/django/test/testcases.py", line 1662, in __call__
    return super().__call__(environ, start_response)
  File "/usr/lib/python3.9/posixpath.py", line 76, in join
    a = os.fspath(a)
  File "/home/nicola/.local/lib/python3.9/site-packages/django/core/handlers/wsgi.py", line 132, in __call__
    response = self.get_response(request)
  File "/home/nicola/.local/lib/python3.9/site-packages/django/utils/_os.py", line 17, in safe_join
    final_path = abspath(join(base, *paths))
  File "/usr/lib/python3.9/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

In this stackoverflow post stackoverflow answer they suggest to set STATIC_ROOT.

I don't know how set this property in settings.py.

The path where I have static files (css,js,images) is

/var/www/html/elastic_queries/python/djangosite/giustiziasite/pygiustizia/static/pygiustizia

What can I do, put path directly in STATIC_ROOT variable?

Back to Top