-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serve static files in web.app.route? #93
Comments
Hi! I'm not sure what you are trying to do. What static files do you want to serve? Something for the locust web UI? |
Yep. Might well not be anything that is useful for a real case scenario. Just putting together a runnable example and thought bundling togheter some simple static html files was easy to show the html-browsing capabilities. Test against it self so to speak. |
Ah, I see. You should be able to do this with a Flask blueprint. Here's an example that should serve the files in the locustfile.py's directory, under /test/static if you put the code in it: import os
from flask import Blueprint
from locust.web import app
root_path = os.path.dirname(os.path.abspath(__file__))
bp = Blueprint("test", __name__, static_folder=root, static_url_path="/static")
app.register_blueprint(bp, url_prefix="/test") |
Works like charm! Thanks! |
Is that possible as of now? Tried reading up on Flask and create a folder named static. But that did not seem to work.
The text was updated successfully, but these errors were encountered: