Issue was older versions of django-pipeline
messaged with mimetypes
entering unicode strings (not byte strings). Updating to version 1.3.22 fixes this.
Django dj-static error when serving JS files
-
08-10-2022 - |
문제
2014-02-08T00:17:59.628381+00:00 app[web.1]: Traceback (most recent call last):
2014-02-08T00:17:59.628381+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/wsgiref/handlers.py", line 85, in run
2014-02-08T00:17:59.628381+00:00 app[web.1]: self.result = application(self.environ, self.start_response)
2014-02-08T00:17:59.628381+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/dj_static.py", line 64, in __call__
2014-02-08T00:17:59.628381+00:00 app[web.1]: return self.cling(environ, start_response)
2014-02-08T00:17:59.628381+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/static/apps.py", line 118, in __call__
2014-02-08T00:17:59.628381+00:00 app[web.1]: start_response("200 OK", headers)
2014-02-08T00:17:59.628381+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/wsgiref/handlers.py", line 180, in start_response
2014-02-08T00:17:59.628381+00:00 app[web.1]: assert type(val) is StringType,"Header values must be strings"
2014-02-08T00:17:59.628381+00:00 app[web.1]: AssertionError: Header values must be strings
I'm getting this. Any ideas? Only happens with JavaScript files. Versions: dj-static==0.0.5, static==1.0.2, and django-pipeline==1.3.16, Django=1.6.1.
해결책 2
다른 팁
Not much of an answer, I know, but taking out dj-static did it for me. You really don't need it if your using pipeline anyway as pipeline takes care of compiling your static files and putting them in a place where they can be served so long as you include the line:
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT})
in your urls.py
제휴하지 않습니다 StackOverflow