cobrateam / cobrateam/django-htmlmin
problem using html_minify in django
- Dominant language
- Python
- Stars
- 542
- Forks
- 72
- PR merge metrics
- No merged PRs in 30d
Description
Hi, thank you for doing this project!
I am trying to manually minify a view in a django project, but I don't have it integrated to the middleware (other views are already taken care of and have a build process)
But I expected to be able to call html_minify on the output of a call to django.shortcuts.render.
Instead I get:
```
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/usr/local/lib/python3.8/site-packages/debug_toolbar/middleware.py", line 67, in __call__
panel.generate_stats(request, response)
File "/usr/local/lib/python3.8/site-packages/debug_toolbar/panels/headers.py", line 53, in generate_stats
self.response_headers = OrderedDict(sorted(response.items()))
Exception Type: AttributeError at /v/27/
Exception Value: 'str' object has no attribute 'items'
```
Maybe there is something in newer django? Or is there some intermediate step in this possibly unusal workflow?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing how html_minify is called on the result of django.shortcuts.render and compare that workflow with the middleware path shown in the traceback. Reproduce the AttributeError involving django-debug-toolbar, then determine whether the manual-render workflow needs a code change or clearer usage guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100