DjangoAdminHackers / django-linkcheck

An app that will analyze and report on links in any model that you register with it. Links can be bare (urls or image and file fields) or embedded in HTML (linkcheck handles the parsing). It's fairly easy to override methods of the Linkcheck object should you need to do anything more complicated (like generate URLs from slug fields etc).
BSD 3-Clause "New" or "Revised" License
75 stars 26 forks source link

Bug when using Django 1.9.9 and whitenoise #57

Closed rerb closed 8 years ago

rerb commented 8 years ago

jquery.min.js isn't at "admin/js/jquery.min.js" in Django v1.9.9, but that's where django-linkcheck still looks for it.

That raises a ValueError: The file 'admin/js/jquery.min.js' could not be found when trying to access admin/linkcheck, which eventually causes a TemplateSyntaxError: "cache" tag got a non-integer timeout value: ''.

Pull request coming.

ERROR Internal Server Error: /_ad/linkcheck/
Traceback (most recent call last):
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/linkcheck/views.py", line 158, in report
    'media':  forms.Media(js=[static('admin/js/jquery.min.js')]),
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/contrib/admin/templatetags/admin_static.py", line 17, in static
    return _static(path)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/contrib/staticfiles/templatetags/staticfiles.py", line 9, in static
    return staticfiles_storage.url(path)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 131, in url
    hashed_name = self.stored_name(clean_name)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 280, in stored_name
    cache_name = self.clean_name(self.hashed_name(name))
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 94, in hashed_name
    (clean_name, self))
ValueError: The file 'admin/js/jquery.min.js' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at 0x1070ad8d0>.
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 177, in __call__
    response = self.get_response(request)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/core/handlers/base.py", line 230, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/core/handlers/base.py", line 296, in handle_uncaught_exception
    return callback(request, **param_dict)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/utils/decorators.py", line 149, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/views/defaults.py", line 63, in server_error
    return http.HttpResponseServerError(template.render())
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/backends/django.py", line 95, in render
    return self.template.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 206, in render
    return self._render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 197, in _render
    return self.nodelist.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 992, in render
    bit = node.render_annotated(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
    return self.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render
    return compiled_parent._render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 197, in _render
    return self.nodelist.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 992, in render
    bit = node.render_annotated(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
    return self.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render
    return compiled_parent._render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 197, in _render
    return self.nodelist.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 992, in render
    bit = node.render_annotated(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
    return self.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render
    return compiled_parent._render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 197, in _render
    return self.nodelist.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 992, in render
    bit = node.render_annotated(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
    return self.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/loader_tags.py", line 173, in render
    return compiled_parent._render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 197, in _render
    return self.nodelist.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 992, in render
    bit = node.render_annotated(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
    return self.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/loader_tags.py", line 69, in render
    result = block.nodelist.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 992, in render
    bit = node.render_annotated(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
    return self.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/defaulttags.py", line 326, in render
    return nodelist.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 992, in render
    bit = node.render_annotated(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/template/base.py", line 959, in render_annotated
    return self.render(context)
  File "/Users/rerb/.virtualenvs/hub/lib/python2.7/site-packages/django/templatetags/cache.py", line 28, in render
    raise TemplateSyntaxError('"cache" tag got a non-integer timeout value: %r' % expire_time)
TemplateSyntaxError: "cache" tag got a non-integer timeout value: ''
[07/Sep/2016 06:38:05] "GET /_ad/linkcheck/ HTTP/1.1" 500 59