Skip to content
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

Fix issues with render_template #1680

Merged
merged 2 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion locust/html.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
from jinja2 import Environment, FileSystemLoader
import os
import pathlib
import datetime
from itertools import chain
from .stats import sort_stats
from flask import render_template


def render_template(file, **kwargs):
templates_path = os.path.join(pathlib.Path(__file__).parent.absolute(), "templates")
env = Environment(loader=FileSystemLoader(templates_path), extensions=['jinja2.ext.do'])
template = env.get_template(file)
return template.render(**kwargs)


def get_html_report(environment, show_download_link=True):
Expand Down
1 change: 1 addition & 0 deletions locust/test/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


app = Flask(__name__)
app.jinja_options['extensions'].append('jinja2.ext.do')


@app.route("/ultra_fast")
Expand Down