django-rednoise icon indicating copy to clipboard operation
django-rednoise copied to clipboard

'DjangoRedNoise' object has no attribute 'mimetypes'

Open thenewguy opened this issue 9 years ago • 12 comments

Just trying out rednoise. Encountered the following:

Django==1.8.2
django-rednoise==1.0.5
uWSGI==2.0.10
whitenoise==2.0
Traceback (most recent call last):
  File "/path/to/python2.7/site-packages/rednoise/base.py", line 112, in __call__
    asset = self.load_static_file(path)
  File "/path/to/python2.7/site-packages/rednoise/base.py", line 232, in load_static_file
    self.add_static_file(path)
  File "/path/to/python2.7/site-packages/rednoise/base.py", line 196, in add_static_file
    files[path] = self.get_static_file(file_path, path)
  File "/path/to/python2.7/site-packages/whitenoise/base.py", line 200, in get_static_file
    self.add_mime_headers(headers, path, url)
  File "/path/to/python2.7/site-packages/whitenoise/base.py", line 214, in add_mime_headers
    mimetype, encoding = self.mimetypes.guess_type(path)
AttributeError: 'DjangoRedNoise' object has no attribute 'mimetypes'

thenewguy avatar Jun 20 '15 17:06 thenewguy

Yeah, that's likely due to the (pushed just today) 2.0 version of WhiteNoise. I've not yet had time to adjust RedNoise for it, but I pretty much already know where/what/how. Just a matter of getting to it.

ryanmcgrath avatar Jun 20 '15 17:06 ryanmcgrath

Yep that was the issue. pip install "whitenoise<2" fixed the problem

thenewguy avatar Jun 20 '15 17:06 thenewguy

@thenewguy Cool! I'd definitely love to hear your feedback; I've been using it so far with no issues but outside perspective is always welcome.

ryanmcgrath avatar Jun 20 '15 17:06 ryanmcgrath

@ryanmcgrath I am only using it locally at the moment but it seems to solve the issues that originally kept me from using whitenoise. I like being able to easily use uwsgi for development over runserver.

thenewguy avatar Jun 23 '15 21:06 thenewguy

Nice! Glad to hear it, that was my motivation as well - Whitenoise 2.0 includes some of this stuff now, but not quite all of it. I'll be updating it shortly to be compatible though.

ryanmcgrath avatar Jun 24 '15 06:06 ryanmcgrath

Hi @ryanmcgrath, any update coming soon to make this work with WhiteNoise 2. I had to pip install "whitenoise<2" as well and make sure my requirements.txt had the v1 of whitenoise.

jerrybroughton avatar Sep 28 '15 17:09 jerrybroughton

Hi, I've ran into the same issue. Using older version of WhiteNoise solved my problem and I'm waiting for new version of this package. Thanks.

nournia avatar Dec 24 '15 15:12 nournia

I've been meaning to circle back to this recently, but it's worth noting: a lot of these changes were cloned into Whitenoise upstream. I'll update the repo at some point here, but a few months ago I spoke with the Whitenoise maintainer and... yeah. Does Rednoise even offer anything new for people at this point?

ryanmcgrath avatar Jan 05 '16 23:01 ryanmcgrath

Any news here or plans to fix it?

schacki avatar Mar 12 '16 19:03 schacki

@ryanmcgrath Yes, I think Red Noise still offers something that White Noise doesn't do. Most importantly (to me):

Not collecting a huge list of (potentially several thousand) static files one time at startup, but progressively adding to the cache as files are requested.

Is it possible to have a version of White Noise that just makes this change, and nothing else, so it's easier to keep up to date? White Noise 3.0 is about to land and Red Noise only works with 1.x

mrmachine avatar Mar 22 '16 06:03 mrmachine

Hmmm, okay then - at this point I'd say I'll update it, but after Whitenoise 3.0 drops. I'm not familiar with the current state of the project, just because it's been a few months since I did a deep dive on it. If there's going to be any major changes or updates (which a 3.0 implies to me) I'd rather let those hit first.

ryanmcgrath avatar Mar 22 '16 08:03 ryanmcgrath

Hey it's dropped: https://github.com/evansd/whitenoise/tree/v3.2.2

And this project would be really useful for some if you'd be interested in keeping it going: https://github.com/pydanny/cookiecutter-django/issues/869

spool avatar Dec 05 '16 12:12 spool