This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
#create the application object | |
app = Flask(__name__) | |
app.config.from_object('config') | |
database.init_app(app) | |
@app.route("/") | |
def main(): | |
# Static Route |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<title>This is Title </title> | |
<body> | |
<h2> | |
<ul> | |
<!--% for user(as variable)--> | |
{% for user in users %} | |
<!--Dan disinilah dynamic route itu berfungsi--> | |
<li><a href="{{ user.url }}">{{ user.username }}</a></li> | |
{% endfor %} | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "layout.html" %} | |
{% block body %} | |
<ul> | |
{% for user in users %} | |
<li><a href="{{ user.url }}">{{ user.username }}</a></li> | |
{% endfor %} | |
</ul> | |
{% endblock %} |