我用 python-flask 建立了一个网站。在一个页面中我加载了一个 javascript 文件。这是我的文件结构:
/python
/static
/plugins
/themes
/default
/js
/my-js.js
/templates
/my-file.html
/venv
app.py
我已将 my-js.js 包含在 my-file.html 中。
在此 js 之前,还有其他脚本成功加载了页面(与 my-js.js 位于同一目录中)。
当我用 url 调用我的文件时,/static/themes/default/js/my-js.js
它会ValueError: View function did not return a response
显示回溯:
Traceback (most recent call last):
File "/Users/ozcan/Library/Python/2.7/lib/python/site-packages/flask/app.py", line 1701, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/ozcan/Library/Python/2.7/lib/python/site-packages/flask/app.py", line 1689, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Users/ozcan/Library/Python/2.7/lib/python/site-packages/flask/app.py", line 1687, in wsgi_app
response = self.full_dispatch_request()
File "/Users/ozcan/Library/Python/2.7/lib/python/site-packages/flask/app.py", line 1361, in full_dispatch_request
response = self.make_response(rv)
File "/Users/ozcan/Library/Python/2.7/lib/python/site-packages/flask/app.py", line 1439, in make_response
raise ValueError('View function did not return a response')
ValueError: View function did not return a response
为什么会发生?我没有为这些js之类的静态文件编写路由。为什么正在加载其他js文件而这个不是?