Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python Render template
#3
this is my code
    # -*- coding: utf-8 -*-
    """
    Created on Thu Apr 26 20:55:49 2018

    @author: Akhou
    """

    import string 
    v={'var1':'screen'}
    x=string.Template("""
    {
    id      :$var1
    width   :22
    height  :123
    """)
    print'Item: ', x.substitute(v)
    y="""
    {
    id      :$sm1
    x       :11
    y       :8
    width   :12
    height  :65
    } 
    """
    print 'Rectangle ' , y%v
now I want to generate a .qml file from it. So I looked on line for an example to follow( atleast to understand the concept) I found that rebder template is able to generate/create a .qml file. I tried this example ( just to understand how it (rendered_teplate) work :
    from flask import Flask, render_template
    from flask import request, jsonify
    app = Flask(__name__)
    @app.route('/', methods=['GET', 'POST'])
    def homepage():
       if request.method == 'POST':
           f1 = request.form['firstVerb'] 
           f2 = request.form['secondVerb']
       return render_template('index.html', f1=f1, f2=f2)

    if __name__ == "__main__":
        app.run(debug=True) 
All I got was that text :
Error:
* Restarting with stat
Reply


Messages In This Thread
python Render template - by Akhou - Apr-26-2018, 09:57 PM
RE: python Render template - by j.crater - Apr-26-2018, 10:27 PM
RE: python Render template - by Akhou - Apr-26-2018, 10:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  What is bug template using python Anldra12 0 970 Nov-02-2021, 11:36 AM
Last Post: Anldra12
  Python C++ Template Equivalent deanhystad 7 3,422 May-04-2021, 07:45 PM
Last Post: deanhystad
  Erreur de code python sur un template rpm de zabbix samba 0 1,932 Apr-02-2021, 09:43 AM
Last Post: samba
  With SplashRequest to run javascript onclick function to render page properly don 0 1,907 Feb-04-2019, 03:29 AM
Last Post: don

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020