python - django debug toolbar - SuspiciousFileOperation: Attempted access to '/static/_img/A/B/image01.png' denied -
i installed django-debug-toolbar , having trouble accessing static files on staging server. error message:
suspiciousfileoperation @ /home/ attempted access '/static/_img/a/b/image01.png' denied. traceback: file "/home/code/venv/x/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response 204. response = middleware_method(request, response) file "/home/code/venv/x/lib/python3.4/site-packages/debug_toolbar/middleware.py" in process_response 129. bits[-2] += toolbar.render_toolbar() file "/home/code/venv/x/lib/python3.4/site-packages/debug_toolbar/toolbar.py" in render_toolbar 64. return render_to_string('debug_toolbar/base.html', context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/loader.py" in render_to_string 172. return t.render(context(dictionary)) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render 148. return self._render(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/test/utils.py" in instrumented_test_render 88. return self.nodelist.render(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render 844. bit = self.render_node(node, context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render_node 858. return node.render(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/defaulttags.py" in render 208. nodelist.append(node.render(context)) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/defaulttags.py" in render 312. return nodelist.render(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render 844. bit = self.render_node(node, context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render_node 858. return node.render(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/defaulttags.py" in render 312. return nodelist.render(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render 844. bit = self.render_node(node, context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render_node 858. return node.render(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render 898. output = self.filter_expression.resolve(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in resolve 596. obj = self.var.resolve(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in resolve 734. value = self._resolve_lookup(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in _resolve_lookup 770. current = getattr(current, bit) file "/home/code/venv/x/lib/python3.4/site-packages/debug_toolbar/panels/__init__.py" in content 96. return render_to_string(self.template, self.get_stats()) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/loader.py" in render_to_string 172. return t.render(context(dictionary)) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render 148. return self._render(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/test/utils.py" in instrumented_test_render 88. return self.nodelist.render(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render 844. bit = self.render_node(node, context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render_node 858. return node.render(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/defaulttags.py" in render 312. return nodelist.render(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render 844. bit = self.render_node(node, context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render_node 858. return node.render(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/defaulttags.py" in render 208. nodelist.append(node.render(context)) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in render 898. output = self.filter_expression.resolve(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in resolve 596. obj = self.var.resolve(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in resolve 734. value = self._resolve_lookup(context) file "/home/code/venv/x/lib/python3.4/site-packages/django/template/base.py" in _resolve_lookup 788. current = current() file "/home/code/venv/x/lib/python3.4/site-packages/debug_toolbar/panels/staticfiles.py" in real_path 34. return finders.find(self.path) file "/home/code/venv/x/lib/python3.4/site-packages/django/contrib/staticfiles/finders.py" in find 249. result = finder.find(path, all=all) file "/home/code/venv/x/lib/python3.4/site-packages/django/contrib/staticfiles/finders.py" in find 159. match = self.find_in_app(app, path) file "/home/code/venv/x/lib/python3.4/site-packages/django/contrib/staticfiles/finders.py" in find_in_app 173. if storage.exists(path): file "/home/code/venv/x/lib/python3.4/site-packages/django/core/files/storage.py" in exists 265. return os.path.exists(self.path(name)) file "/home/code/venv/x/lib/python3.4/site-packages/django/core/files/storage.py" in path 281. raise suspiciousfileoperation("attempted access '%s' denied." % name) exception type: suspiciousfileoperation @ /a/ exception value: attempted access '/static/_img/a/b/image01.png' denied.
the error message occurs change setting debug = true. don't think it's folder permissions issue static folder images load fine when debug = false.
please let me know if more info needed.
edit i've posted correct traceback.
static files config (from settings.py):
static_url = "/static/" staticfiles_dir = ( "/var/www/html/static", ) static_root = os.path.join(base_dir, "static") installed_apps = ( ... "django.contrib.staticfiles", ... ) staticfiles_finders = ( "django.contrib.staticfiles.finders.appdirectoriesfinder", "django.contrib.staticfiles.finders.filesystemfinder", "compressor.finders.compressorfinder" )
Comments
Post a Comment