Created
January 19, 2020 17:20
-
-
Save MortallaSane/53e061ec4e5d68a7829f68d857588bdc to your computer and use it in GitHub Desktop.
Flask tiny project
This file contains hidden or 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, render_template | |
import urllib3 as url | |
app = Flask(__name__) | |
@app.route("/") | |
@app.route("/index/<argument>") | |
def show_index(): | |
title = "index baby" | |
sections = {1: "Mobilní telefony", 2: "Vertikutátory", 3: "Hudební nástroje"} | |
return render_template("index.html", title="Homepage",sections = sections) | |
@app.route("/sekce") | |
def show_section(): | |
title = "index baby" | |
sections = {1: "Mobilní telefony", 2: "Vertikutátory", 3: "Hudební nástroje"} | |
return render_template("index.html", title="Sekce", section = sections) | |
@app.route("/test") | |
def show_api_output(): | |
title = "index baby" | |
sections = {1: "Mobilní telefony", 2: "Vertikutátory", 3: "Hudební nástroje"} | |
return render_template("index.html", title="Testday", sections = sections) | |
# request = Request('http://python-servers-vtnovk529892.codeanyapp.com:5000/categories/') | |
# http = url.PoolManager() | |
# section_dictionary = {1: "Mobilní telefony", 2: "Vertikutátory", 3:"Hudební nástroje"} | |
# response_body = http.request('GET', 'http://private-5a2112-catalogue9.apiary-mock.com/categories/') |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<link rel= "stylesheet" type= "text/css" href= "{{ url_for('static',filename='styles/main.css') }}"> | |
<title>{% block title %}{% endblock %}</title> | |
</head> | |
<body> | |
<header id="header"> | |
<div class="innertube"> | |
<h1>Homepage - testday</h1> | |
</div> | |
</header> | |
<div id="wrapper"> | |
<main> | |
<div id="content"> | |
<div class="innertube"> | |
<h1>Heading</h1> | |
<div class="grid-container"> | |
{% for s in sections %} | |
<div class="item{{s}}"><a href="/categories/{{s}}">{{ sections[s] }} </a></div> | |
{% endfor %} | |
</div> | |
{{argument}} | |
</div> | |
</div> | |
</main> | |
<nav id="nav"> | |
<div class="innertube"> | |
<h3>Sekce</h3> | |
<ul> | |
{% for s in sections %} | |
<li><a href="#">{{ sections[s] }} </a> </li> | |
{% endfor %} | |
</ul> | |
</div> | |
</nav> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment