ryanmcgrath / django-rednoise

An opinionated addon for WhiteNoise, with a focus on Django environments.
Other
18 stars 2 forks source link

'DjangoRedNoise' object has no attribute 'mimetypes' #1

Open thenewguy opened 9 years ago

thenewguy commented 9 years ago

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'
ryanmcgrath commented 9 years ago

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.

thenewguy commented 9 years ago

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

ryanmcgrath commented 9 years ago

@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.

thenewguy commented 9 years ago

@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.

ryanmcgrath commented 9 years ago

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.

jerrybroughton commented 8 years ago

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.

nournia commented 8 years ago

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.

ryanmcgrath commented 8 years ago

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?

schacki commented 8 years ago

Any news here or plans to fix it?

mrmachine commented 8 years ago

@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

ryanmcgrath commented 8 years ago

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.

spool commented 7 years ago

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