nickjj / flask-static-digest

Flask extension to help make your static files production ready by md5 tagging and gzipping them.
MIT License
157 stars 27 forks source link

Blacklist Filter Array - Default Setting #15

Closed maxdemaio closed 3 years ago

maxdemaio commented 3 years ago

Hey all,

When I installed Flask-Static-Digest the flask digest clean command worked perfectly and it found my static folder. However, when trying flask digest compile I ran into this error (keep in mind I'm on Windows):

File c:\users\maxde\desktop\mycodingfiles\environments\mflask\lib\site-packages\flask_static_digest\digester.py", line 95, in _is_compiled_file
    or file_extension in digest_blacklist_filter
TypeError: argument of type 'NoneType' is not iterable

However I was able to fix this by specifying the blacklist array in my app.py in the code block below. I took a peek at the __init__.py file and it seems like it should be defaulting to an empty array, but for some reason it wasn't the case for me. Just want to help out future devs who run into the same issue!

app.config['FLASK_STATIC_DIGEST_BLACKLIST_FILTER'] = []

Btw thanks Nick for this awesome repo!

-Max

nickjj commented 3 years ago

Hi,

Hmm yeah it should default to []. I am using this project in a few apps where I haven't explicitly defined it and it doesn't blow up with that error in either compile or clean. I'm not sure why Windows would be treated any differently.

Both compile and clean use the same copy of the variable here: https://github.com/nickjj/flask-static-digest/blob/79886dcd43cdc5548d731bb1f7dfa69065f14283/flask_static_digest/cli.py#L22-L31

At a glance that looks like it would default to None, but it's being set to an empty list here: https://github.com/nickjj/flask-static-digest/blob/df876aa5d6838c19cfd81602bf1a01d5a3e359b2/flask_static_digest/__init__.py#L24