Skip to content

Instantly share code, notes, and snippets.

View sinar96's full-sized avatar

Sinar Mustika Ruslan sinar96

  • Makassar, Sulawesi Selatan, Indonesia
View GitHub Profile
@sinar96
sinar96 / layout.html
Created July 28, 2016 08:27
untuk memanggil layout-list yang telah kita buat.
<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>
@sinar96
sinar96 / layout-list.html
Last active July 28, 2016 08:19
Contoh fungsi penggunaan Jinja
{% extends "layout.html" %}
{% block body %}
<ul>
{% for user in users %}
<li><a href="{{ user.url }}">{{ user.username }}</a></li>
{% endfor %}
</ul>
{% endblock %}
@sinar96
sinar96 / Learn route in Flask
Last active July 28, 2016 12:42
Code ini akan membantu kalian untuk memahami perbedaan code pada Static Route dan Dynamic route
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