stephenmcd / mezzanine

CMS framework for Django
http://mezzanine.jupo.org
BSD 2-Clause "Simplified" License
4.75k stars 1.64k forks source link

media upload in default project fails with undefined THUMBNAILS_DIR_NAME #1995

Closed niol closed 2 years ago

niol commented 3 years ago

Creating the default project with:

mezzanine-project project_name
cd project_name
python3 manage.py createdb --noinput
python3 manage.py changepassword admin
python3 manage.py runserver

and trying to upload a file in the gallery results in the following exception:

Internal Server Error: /admin/media-library/upload_file/
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", line
34, in inner
    response = get_response(request)
  File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 115,
in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 113,
in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3/dist-packages/django/views/decorators/csrf.py", line 54
, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/django/contrib/auth/decorators.py", line
21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/filebrowser_safe/views.py", line 399, in
_upload_file
    remove_thumbnails(file_path)
  File "/usr/lib/python3/dist-packages/filebrowser_safe/views.py", line 79, in r
emove_thumbnails
    path = os.path.join(dir_name, settings.THUMBNAILS_DIR_NAME, file_name)
  File "/usr/lib/python3/dist-packages/django/conf/__init__.py", line 80, in __g
etattr__
    val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'THUMBNAILS_DIR_NAME'

Adding the following line to local_settings.py works around the problem:

THUMBNAILS_DIR_NAME = ".thumbnails"
jerivas commented 3 years ago

What version of mezzanine are you using?

niol commented 3 years ago

I'm using tag v5.0.0-rc.1 https://github.com/stephenmcd/mezzanine/commit/74038157be24c882960130072ae1471c7777774d

jerivas commented 2 years ago

Fixed in https://github.com/stephenmcd/filebrowser-safe/commit/f9991d50f7e739b9eec5731c340be964a472c03e. You can upgrade with pip install filebrowser-safe==1.0.0rc2.