Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR 500 when i try to view Report or Product #39

Closed
kaal18 opened this issue Apr 17, 2022 · 7 comments
Closed

ERROR 500 when i try to view Report or Product #39

kaal18 opened this issue Apr 17, 2022 · 7 comments

Comments

@kaal18
Copy link

kaal18 commented Apr 17, 2022

I just installed the petereport via Docker and i'm getting this error 500 when i try to view product or report etc..
I tried installing multiple times still no luck.

Screenshots :

image

image

image

image

I turned on the debug mode and i got below error.

image

Error during template rendering

In template /opt/petereport/app/preport/templates/home/template.html, error at line 0
clean() got an unexpected keyword argument 'styles'
1 	<!DOCTYPE html>
2 	<html lang="en">
3 	<head>
4 	    {% block head %}
5 	      {% block meta %}
6 	        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7 	        <meta charset="utf-8">
8 	        <meta http-equiv="X-UA-Compatible" content="IE=edge">
9 	        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
10 	      {% endblock meta %}
Environment:


Request Method: GET
Request URL: http://127.0.0.1/product/view/1

Django Version: 3.2.5
Python Version: 3.8.10
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'martor',
 'django_bleach',
 'preport']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']


Template error:
In template /opt/petereport/app/preport/templates/home/template.html, error at line 0
   clean() got an unexpected keyword argument 'styles'
   1 : <!DOCTYPE html>
   2 : <html lang="en">
   3 : <head>
   4 :     {% block head %}
   5 :       {% block meta %}
   6 :         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   7 :         <meta charset="utf-8">
   8 :         <meta http-equiv="X-UA-Compatible" content="IE=edge">
   9 :         <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
   10 :       {% endblock meta %}


Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.8/dist-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/opt/petereport/app/preport/views.py", line 358, in product_view
    return render(request, 'products/product_view.html', {'pk': pk, 'DB_product_query': DB_product_query, 'DB_report_query': DB_report_query, 'count_product_report': count_product_report, 'product_findings': count_product_findings_total, 'count_product_findings_critical_high': count_product_findings_critical_high, 'count_product_findings_medium': count_product_findings_medium})
  File "/usr/local/lib/python3.8/dist-packages/django/shortcuts.py", line 19, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "/usr/local/lib/python3.8/dist-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "/usr/local/lib/python3.8/dist-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/base.py", line 170, in render
    return self._render(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/base.py", line 988, in render
    output = self.filter_expression.resolve(context)
  File "/usr/local/lib/python3.8/dist-packages/django/template/base.py", line 698, in resolve
    new_obj = func(obj, *arg_vals)
  File "/usr/local/lib/python3.8/dist-packages/django_bleach/templatetags/bleach_tags.py", line 23, in bleach_value
    bleached_value = bleach.clean(value, **args)

Exception Type: TypeError at /product/view/1
Exception Value: clean() got an unexpected keyword argument 'styles'
@noraj
Copy link
Contributor

noraj commented Apr 17, 2022

Same here with latest commit 0cafe85

@kaal18
Copy link
Author

kaal18 commented Apr 18, 2022

Temporary solution is to revert back to commit 1d95bad
git reset --hard 1d95bad

And then ,
docker-compose up --build

@ky0112
Copy link

ky0112 commented Apr 25, 2022

Hitting the same 500 error when creating PDF report

@1modm
Copy link
Owner

1modm commented Apr 28, 2022

Hi All,

Thank you for getting this to me, I was investigating the issue, it seems that python 3.10 is installed with docker, and there are some issues with a couple of libraries; bleach and collections. For backwards compatibility, they continue to be visible in this module through Python 3.9.

So I recommended to start the server manually using python < 3.10 until I found the way to update those libraries or force docker to use python 3.9.

Thanks

@1modm
Copy link
Owner

1modm commented Apr 30, 2022

Should be fixed in the last commit, take a look and let me know if do you find any other issue.

@1modm 1modm closed this as completed Apr 30, 2022
@ky0112
Copy link

ky0112 commented Apr 30, 2022

Hi
Still getting the error 500 while creating a pdf report, which have a lot of base64 image in it.

image
Thanks

@1modm
Copy link
Owner

1modm commented Apr 30, 2022

@ky0112 this is a different issue than this one, could you open a new issue providing more details, for example enabling the debug mode and adding the output?

To enable debug mode, change 'debug': True in config file: /app/config)/petereport_config.py

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants