Nested Bottle app with Waitress #76
I am building a web application using nested Bottle apps and I'm having problems returning a static file from the nested app when running the site through the Waitress web server. It works fine when run with WSGIRefServer, which suggests a problem with Waitress.
Sample app that replicates the issue below (browse to
from bottle import Bottle, run, static_file baseapp = Bottle() app = Bottle() baseapp.mount("/test/", app) @app.get("/") def index(): return """<!DOCTYPE html> <html><body> <p>Result: <span id="asdf">Failed :(</span></p> <script src="js"></script> </body></html> """ @app.get("/js") def js(): return static_file("test.js", "./") run(app = baseapp, server="waitress", url="0.0.0.0", port=8080) #run(app = baseapp, url="0.0.0.0", port=8080)
Contents of test.js:
document.getElementById('asdf').innerHTML = 'Worked! :)';
I'm running Python 3.4.2 with Bottle 0.12.7 and Waitress 0.8.9. (downloaded via pip).
The text was updated successfully, but these errors were encountered:
I have the same issue,
Seems to be to do with how waitress implements 'wsgi.file_wrapper'
In the bottle app, if I remove 'wsgi.file_wrapper' from request.environ then it all works fine.
This causes an iterable file wrapper to be created, which avoids the problem,
Have looked into this a little deeper and I'm not convinced this is a waitress bug,
So this means that until
This becomes a problem if used in a nested bottle app
In our case, the above wrapper is called before
I have found that adding
Why should bottle check whether or not