I'm using send_from_directory
in flask to serve some static js assets. The app structure looks like this:
/BaseFolder
/App
__init__.py
/js/
jquery.js
run.py
/js/
jquery.js
The __init__.py
is responsible for most of the app management and has the following:
app = Flask(__name__)
[...]
@app.route('/js/<path:path>')
def send_js(path):
return send_from_directory('js',path)
[...]
def go():
[...]
app.run()
The app itself kicks off from the run.py file which runs the go function in the file above. (this essentially mirrors the app setup of the app in Flask Web Development so it should be a typical use case for Flask.)
Theoretically, the send_js function should return a file from either the App/js/ or the js/ directory. However, removing either of these files causes the application to 404. (The app serves the contents of the lower one; even touch js/jquery.js
in the upper folder is enough to make things work.)
Why does this happen?