python - Flask - How to print different variables on the same page -


I am trying to print a list of entries, total entry and the time generated in the flask. I have in my Pyro code:

  def stream_tomplate (template_name, ** reference): app .update_template_context (context) t = app.jinja_env.get_template (template_name) rv = t.stream ( References) Reverse RV @ app There is something here for preparing for #Doll data: root ('/', methods = ['post']) DEF get_data (): generated_time = get_generated_time () entry_list = get_entry () def blog_entries (): Entry_list for Entry: Product Entry Return Response (Stream_Template ('blog.html', Data = Blog_entry ())   

I have blog_entry (): (for testing) Purpose ) In category (i) (5)]

I have in blog.html: (For the purpose of the test, each entry Person to assume as an integer)

  data {% i:%} & lt; Br> Entry: {{i}} & lt; / Br & gt; {% Endfor%}   

As a result, I will get a list of all entries. However, I would like to print the entries on printed page and then print_outry and generated_time before printing, how should I change my Python code and HTML template? Example: I have to do something like this:

  Total Entry: 5 Generated Time: 0.001 Entry: 1 Entry: 2 Entry: 3 Entry: 4 Entry: 5   

Thanks a lot!

Just pass the word as ** context as a keyword argument. It should work but I have not tested it.

The documentation has been given here. Get_entry (): #Dog data for DF blog_entries () Here's something to prepare for: get_entry ( ) To enter: Product Entry Return Response (stream_tomplate ('blog.html', data = blog_entries (), total_entries = get_total_entry (), gen_time = Get_generated_time ()))

given Jinnah 2 template. Formatting changed to a list. You can access the keyword logic in the Jinnah 2-timepiece by using the correct names.

  & lt; Ul & gt; & Lt; Li & gt; Total entries: {{total_entries}} & lt; / Li & gt; & Lt; Li & gt; Generated time: {{gen_timeÂ}} & lt; / Li & gt; {% I in the data:%} & lt; Li & gt; Entry: {{i}} & lt; / Li & gt; {% Endfor%} & lt; / Ul & gt;    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -