nickjj / flask-static-digest

Flask extension to help make your static files production ready by md5 tagging and gzipping them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It dosen't work in windows.

Shimada666 opened this issue · comments

I found that this extension does not work properly under Windows. After reading the source code, I found out that the filename saved in cache_manifest.json is 'xx\xx', but the filename passed under windows is 'xx/xx', in cache_manifest.json. I can't find the corresponding value, so I submitted the PR and added support for windows.

Hi,

Thanks for the report.

Are you running Windows in production? Just asking because under normal circumstances you wouldn't be running the digest command in development.

No, it's in development. And I mean, In windows, the function static_url_for doesn't work. The example you provided doesn't seem to work in Windows.

In the sample program:

127.0.0.1 - - [14/Nov/2019 23:10:35] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask\app.py", line 2309, in call
return self.wsgi_app(environ, start_response)
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask\app.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask\app.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask_compat.py", line 35, in reraise
raise value
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask\app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask_compat.py", line 35, in reraise
raise value
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask\app.py", line 1799, in dispatch_request
return self.view_functionsrule.endpoint
File "F:\PycharmProjects\flask-static-digest\tests\example_app\example\app.py", line 16, in index
return render_template("index.html")
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask\templating.py", line 135, in render_template
context, ctx.app)
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask\templating.py", line 117, in render
rv = template.render(context)
File "f:\redrock\py\pycharmprojects\lib\site-packages\jinja2\asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "f:\redrock\py\pycharmprojects\lib\site-packages\jinja2\environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "f:\redrock\py\pycharmprojects\lib\site-packages\jinja2\environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "f:\redrock\py\pycharmprojects\lib\site-packages\jinja2_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "F:\PycharmProjects\flask-static-digest\tests\example_app\example\templates\index.html", line 1, in top-level template code
{% extends 'layout.html' %}
File "F:\PycharmProjects\flask-static-digest\tests\example_app\example\templates\layout.html", line 5, in top-level template code
href="{{ static_url_for('static', filename='css/app.css') }}">
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask_static_digest_init
.py", line 74, in static_url_for
return flask_url_for(endpoint, **merged_values)
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask\helpers.py", line 356, in url_for
return appctx.app.handle_url_build_error(error, endpoint, values)
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask\app.py", line 2061, in handle_url_build_error
reraise(exc_type, exc_value, tb)
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask_compat.py", line 35, in reraise
raise value
File "f:\redrock\py\pycharmprojects\lib\site-packages\flask\helpers.py", line 345, in url_for
force_external=external)
File "f:\redrock\py\pycharmprojects\lib\site-packages\werkzeug\routing.py", line 1776, in build
raise BuildError(endpoint, values, method, self)
werkzeug.routing.BuildError: Could not build url for endpoint 'static'. Did you forget to specify values ['filename']?

Hey, could you check my PR? I want to use this plugin in my project.

Windows support is available now in v0.1.3.