Tests: ERROR (
···· EEEEEE....FE.....EEE..................
···· FAILED (failures=1, errors=11)
)
Version: (
···· FileBrowser 3.6.1, Grappelli 2.7.1, Django 1.8.3,
···· Python 2.7.6, Pillow 2.9.0
)
apt-get libraries for images/files: (
···· libjpeg8, libjpeg8-dev, zlib1g-dev, libfreetype6,
···· libfreetype6-dev, libjpeg-turbo8, libjpeg-turbo8-dev, libpng12-dev
)
SUMMARY
Filebrowser fails silently from GUI at generating versions (just 404 errors are seen when running python manage.py runserver
). However, I can see the original image is uploaded to STATIC_ROOT/uploads
- and accessible via web browser aiming to STATIC_URL
-, but versions are not generated at STATIC_ROOT/_versions
folder.
DETAILS
- relevant settings in `myproject/settings.py`
- The whole output of `python manage.py test filebrowser`
I'm not sure if I did anything wrong with myproject/settings.py
, so here I post the relevant settings for django-filebrowser:
INSTALLED_APPS = (
'grappelli',
'filebrowser',
'modeltranslation',
# ...
)
FILEBROWSER_DIRECTORY = "static/uploads/"
FILEBROWSER_VERSIONS_BASEDIR = "static/_versions"
FILEBROWSER_VERSIONS = {
'admin_thumbnail': {'verbose_name': 'Admin Thumbnail', 'width': 60, 'height': 60, 'opts': 'crop'},
'thumbnail': {'verbose_name': 'Thumbnail (1 col)', 'width': 60, 'height': 60, 'opts': 'crop'},
'small': {'verbose_name': 'Small (2 col)', 'width': 140, 'height': '', 'opts': ''},
'medium': {'verbose_name': 'Medium (4col )', 'width': 300, 'height': '', 'opts': ''},
'big': {'verbose_name': 'Big (6 col)', 'width': 460, 'height': '', 'opts': ''},
'large': {'verbose_name': 'Large (8 col)', 'width': 680, 'height': '', 'opts': ''},
# ...long story short...
'my_custom': {'verbose_name': 'Large (8 col)', 'width': 1202, 'height': 100, 'opts': 'crop'},
}
FILEBROWSER_DIRECTORY = "static/uploads/"
FILEBROWSER_VERSIONS_BASEDIR = "static/_versions"
STATICFILES_DIRS = (
os.path.join(PROJECT_DIR, "static"),
os.path.join(BASE_DIR, "static/admin/js"),
os.path.join(BASE_DIR, "static/*"),
)
# XXX HACK This is ugly because it overrides the default behaviour
# ........ of Django, but it worked for me to fix Grappelli's GUI
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
)
When I perform the tests, the results seem completely catastrophic. It called my attention the fact that tests seem to be looking for PIL(which is deprecated and NOT installed in my machine):
('Creating Test for the FileBrowser site:', 'filebrowser')
Creating test database for alias 'default'...
EEEEEE....FE.....EEE..................
Select a version you want to generate:
* large
* admin_thumbnail
(leave blank to generate all versions): generating version "large" for: fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub/testimage.jpg
E.
======================================================================
ERROR: runTest (filebrowser.tests.test_sites.TestSite_filebrowser)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_sites.py", line 438, in runTest
test_browse(self)
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_sites.py", line 47, in test_browse
response = test.c.get(url)
File "/venvs/mdrcms/lib/python2.7/site-packages/django/test/client.py", line 500, in get
**extra)
File "/venvs/mdrcms/lib/python2.7/site-packages/django/test/client.py", line 303, in get
return self.generic('GET', path, secure=secure, **r)
File "/venvs/mdrcms/lib/python2.7/site-packages/django/test/client.py", line 379, in generic
return self.request(**r)
File "/venvs/mdrcms/lib/python2.7/site-packages/django/test/client.py", line 466, in request
six.reraise(*exc_info)
File "/venvs/mdrcms/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/decorators.py", line 45, in decorator
return function(request, *args, **kwargs)
File "/venvs/mdrcms/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 22, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/venvs/mdrcms/lib/python2.7/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/sites.py", line 349, in browse
}, context_instance=Context(request, current_app=self.name))
File "/venvs/mdrcms/lib/python2.7/site-packages/django/shortcuts.py", line 45, in render_to_response
using=using)
File "/venvs/mdrcms/lib/python2.7/site-packages/django/template/loader.py", line 116, in render_to_string
template_name, context, context_instance, dirs, dictionary)
File "/venvs/mdrcms/lib/python2.7/site-packages/django/template/engine.py", line 221, in render_to_string
return t.render(context_instance)
File "/venvs/mdrcms/lib/python2.7/site-packages/django/template/base.py", line 208, in render
with context.bind_template(self):
File "/usr/bin/python2.7.9/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/venvs/mdrcms/lib/python2.7/site-packages/django/template/context.py", line 241, in bind_template
updates.update(processor(self.request))
File "/venvs/mdrcms/mdrcms/coreapp/context.py", line 11, in navbar
current_siteman = SiteManager.objects.get(id=current_site.id)
File "/venvs/mdrcms/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/venvs/mdrcms/lib/python2.7/site-packages/django/db/models/query.py", line 334, in get
self.model._meta.object_name
DoesNotExist: SiteManager matching query does not exist.
======================================================================
ERROR: test_scale_crop (filebrowser.tests.test_versions.VersionTemplateTagsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_versions.py", line 44, in setUp
self.original_placeholder = filebrowser.templatetags.fb_versions.PLACEHOLDER
AttributeError: 'module' object has no attribute 'fb_versions'
======================================================================
ERROR: test_version (filebrowser.tests.test_versions.VersionTemplateTagsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_versions.py", line 44, in setUp
self.original_placeholder = filebrowser.templatetags.fb_versions.PLACEHOLDER
AttributeError: 'module' object has no attribute 'fb_versions'
======================================================================
ERROR: test_version_as_object (filebrowser.tests.test_versions.VersionTemplateTagsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_versions.py", line 44, in setUp
self.original_placeholder = filebrowser.templatetags.fb_versions.PLACEHOLDER
AttributeError: 'module' object has no attribute 'fb_versions'
======================================================================
ERROR: test_version_object (filebrowser.tests.test_versions.VersionTemplateTagsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_versions.py", line 44, in setUp
self.original_placeholder = filebrowser.templatetags.fb_versions.PLACEHOLDER
AttributeError: 'module' object has no attribute 'fb_versions'
======================================================================
ERROR: test_version_setting (filebrowser.tests.test_versions.VersionTemplateTagsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_versions.py", line 44, in setUp
self.original_placeholder = filebrowser.templatetags.fb_versions.PLACEHOLDER
AttributeError: 'module' object has no attribute 'fb_versions'
======================================================================
ERROR: test_delete (filebrowser.tests.test_base.FileObjectAttributeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_base.py", line 438, in test_delete
f_version = self.f_image.version_generate("large")
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 506, in version_generate
version_path = self._generate_version(version_suffix)
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 527, in _generate_version
version = scale_and_crop(im, VERSIONS[version_suffix]['width'], VERSIONS[version_suffix]['height'], VERSIONS[version_suffix]['opts'])
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/utils.py", line 85, in scale_and_crop
im = im.resize((int(math.ceil(x * r)), int(math.ceil(y * r))), resample=Image.ANTIALIAS)
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 1557, in resize
self.load()
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/ImageFile.py", line 203, in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 420, in _getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available
======================================================================
ERROR: test_version_attributes_1 (filebrowser.tests.test_base.FileObjectAttributeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_base.py", line 317, in test_version_attributes_1
f_version = self.f_image.version_generate("large")
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 506, in version_generate
version_path = self._generate_version(version_suffix)
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 527, in _generate_version
version = scale_and_crop(im, VERSIONS[version_suffix]['width'], VERSIONS[version_suffix]['height'], VERSIONS[version_suffix]['opts'])
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/utils.py", line 85, in scale_and_crop
im = im.resize((int(math.ceil(x * r)), int(math.ceil(y * r))), resample=Image.ANTIALIAS)
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 1557, in resize
self.load()
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/ImageFile.py", line 203, in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 420, in _getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available
======================================================================
ERROR: test_version_attributes_2 (filebrowser.tests.test_base.FileObjectAttributeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_base.py", line 362, in test_version_attributes_2
f_version = self.f_image.version_generate("large")
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 506, in version_generate
version_path = self._generate_version(version_suffix)
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 527, in _generate_version
version = scale_and_crop(im, VERSIONS[version_suffix]['width'], VERSIONS[version_suffix]['height'], VERSIONS[version_suffix]['opts'])
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/utils.py", line 85, in scale_and_crop
im = im.resize((int(math.ceil(x * r)), int(math.ceil(y * r))), resample=Image.ANTIALIAS)
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 1557, in resize
self.load()
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/ImageFile.py", line 203, in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 420, in _getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available
======================================================================
ERROR: test_version_attributes_3 (filebrowser.tests.test_base.FileObjectAttributeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_base.py", line 408, in test_version_attributes_3
f_version = self.f_image.version_generate("large")
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 506, in version_generate
version_path = self._generate_version(version_suffix)
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 527, in _generate_version
version = scale_and_crop(im, VERSIONS[version_suffix]['width'], VERSIONS[version_suffix]['height'], VERSIONS[version_suffix]['opts'])
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/utils.py", line 85, in scale_and_crop
im = im.resize((int(math.ceil(x * r)), int(math.ceil(y * r))), resample=Image.ANTIALIAS)
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 1557, in resize
self.load()
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/ImageFile.py", line 203, in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 420, in _getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available
======================================================================
ERROR: test_fb_version_generate (filebrowser.tests.test_commands.CommandsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_commands.py", line 99, in test_fb_version_generate
call_command('fb_version_generate', 'fb_test_directory')
File "/venvs/mdrcms/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
return command.execute(*args, **defaults)
File "/venvs/mdrcms/lib/python2.7/site-packages/django/core/management/base.py", line 444, in execute
output = self.handle(*args, **options)
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/management/commands/fb_version_generate.py", line 68, in handle
versionobject = fileobject.version_generate(selected_version) # FIXME force?
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 506, in version_generate
version_path = self._generate_version(version_suffix)
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/base.py", line 527, in _generate_version
version = scale_and_crop(im, VERSIONS[version_suffix]['width'], VERSIONS[version_suffix]['height'], VERSIONS[version_suffix]['opts'])
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/utils.py", line 85, in scale_and_crop
im = im.resize((int(math.ceil(x * r)), int(math.ceil(y * r))), resample=Image.ANTIALIAS)
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 1557, in resize
self.load()
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/ImageFile.py", line 203, in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
File "/venvs/mdrcms/lib/python2.7/site-packages/PIL/Image.py", line 420, in _getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available
======================================================================
FAIL: test_walk (filebrowser.tests.test_base.FileListingTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/venvs/mdrcms/lib/python2.7/site-packages/filebrowser/tests/test_base.py", line 584, in test_walk
self.assertEqual(list(f.path for f in self.f_listing.files_walk_total()), [u'fb_test_directory/testimage.jpg', u'fb_test_directory/fb_tmp_dir', u'fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub', u'fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub/testimage.jpg'])
AssertionError: Lists differ: [u'fb_test_directory/testimage... != [u'fb_test_directory/testimage...
First differing element 1:
fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub
fb_test_directory/fb_tmp_dir
[u'fb_test_directory/testimage.jpg',
+ u'fb_test_directory/fb_tmp_dir',
u'fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub',
- u'fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub/testimage.jpg',
? ^
+ u'fb_test_directory/fb_tmp_dir/fb_tmp_dir_sub/testimage.jpg']
? ^
- u'fb_test_directory/fb_tmp_dir']
----------------------------------------------------------------------
Ran 40 tests in 1.790s
FAILED (failures=1, errors=11)
Destroying test database for alias 'default'...
I wonder why are tests looking for PIL if it is a deprecated library, and even the README file says that Pillow has to be used instead...