Hellowings,
sorry for lame question for lame problem, maybe someone will find joy in helping me:
I created .py file with following code:
What is wrong, please?
Sincerely,
Noob Noob
WEIT!
I am just reading file named user.html in the same directory and with code
....or is it not?... O.o
confused...
...lookin...lookin... and nuthin... 0.0
sorry for lame question for lame problem, maybe someone will find joy in helping me:
I created .py file with following code:
from flask import Flask, render_template app = Flask(__name__) @app.route("/") @app.route("/<user>") def index(user = None): return render_template("user.html", user=user) @app.route("/shopping") def shopping(): food = ["Cheese", "Tuna", "Beef"] return render_template("shopping.html", food = food) if __name__ == "__main__": app.run(debug=True)created directory template, created HTML doc named shopping.html with:
<!doctype html> <ul> {% for item in food %} <h1> "this should work </h1> <li>{{ item }}</li> {% endfor %} </ul>and when I hit Run and go at 127.0.0.1:5000/shopping instead of juicy beef I see text "Hello Shopping".
What is wrong, please?
Sincerely,
Noob Noob
WEIT!
I am just reading file named user.html in the same directory and with code
<!doctype html> {% if user %} <h1>Hello {{ user }} </h1> {% else %} <h1> Please log in</h1> {% endif %}butt why is it calling user.html instead of shopping.html?
....or is it not?... O.o
confused...
...lookin...lookin... and nuthin... 0.0