Flask看不到静态文件

时间:2018-12-12 20:19:07

标签: python flask

关于,到目前为止,我一直在查看我的静态文件。我正在使用VS Code作为编辑器。我无意中单击了调试模式,然后它停止查看我的静态文件。我再次启动VS Code,但结果没有改变。我怎么解决这个问题?当我打开localhost时,它显示 127.0.0.1:5000/static/css/main.css ,但是当我显示页面源代码并在新页面上打开CSS文件时,它给出了一个错误。

我在浏览器中遇到的错误是: TypeError:make_conditional()得到了意外的关键字参数'accept_ranges'

我在VS Code中收到的错误如下:

127.0.0.1 - - [12/Dec/2018 23:17:50] "GET /static/css/main.css HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.6/site-packages/flask/helpers.py", line 976, in send_static_file
    cache_timeout=cache_timeout)
  File "/usr/local/lib/python3.6/site-packages/flask/helpers.py", line 713, in send_from_directory
    return send_file(filename, **options)
  File "/usr/local/lib/python3.6/site-packages/flask/helpers.py", line 628, in send_file
    complete_length=fsize)
TypeError: make_conditional() got an unexpected keyword argument 'accept_ranges'

1 个答案:

答案 0 :(得分:0)

根据烧瓶,所需的Werkzeug版本为here中的Werkzeug> = 0.14