Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 21 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
FLASK_APP=webface
FLASK_APP=webface.py
FLASK_RUN_PORT=54321
FLASK_ENV=development
#FLASK_DEBUG=1
FLASK_DEBUG=1
2 changes: 1 addition & 1 deletion .flaskenv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FLASK_APP=webface
FLASK_APP=webface.py
FLASK_ENV=production
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"emmet.includeLanguages": {
"jinja-html": "html",
"vue-html": "html"
}
},
"python.formatting.provider": "black"
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Open in Visual Studio Code](https://classroom.github.com/assets/open-in-vscode-c66648af7eb3fe8bc4f294546bfd86ef473780cde1dea487d3c4ff354943c9ae.svg)](https://classroom.github.com/online_ide?assignment_repo_id=8703051&assignment_repo_type=AssignmentRepo)
[![Open in Visual Studio Code](https://classroom.github.com/assets/open-in-vscode-c66648af7eb3fe8bc4f294546bfd86ef473780cde1dea487d3c4ff354943c9ae.svg)](https://classroom.github.com/online_ide?assignment_repo_id=8703049&assignment_repo_type=AssignmentRepo)
Flask Start OneFile
=========================

Expand Down
Binary file added SQLlite.db
Binary file not shown.
Binary file added data.db
Binary file not shown.
37 changes: 37 additions & 0 deletions mysqlite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import sqlite3


class SQLite():
def __init__(self, file='db.sqlite3'):
self.file=file
def __enter__(self):
self.conn = sqlite3.connect(self.file)
self.conn.row_factory = sqlite3.Row
return self.conn.cursor()
def __exit__(self, type, value, traceback):
self.conn.commit()
self.conn.close()


if __name__ == '__main__':
with SQLite("SQLlite.db") as cur:
sql = """
CREATE TABLE "adresy"(
"zkratka" TEXT NOT NULL,
"adresa" TEXT NOT NULL,
"user: TEXT,
PRIMARY KEY("zkratka")
);
"""
cur.execute(sql)

sql = """
CREATE TABLE "user"(
"login" TEXT,
"passwd" TEXT,
PRIMARY KEY("login")
);


"""
cur.execute(sql)
Binary file added static/banán.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/pomeranc.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 31 additions & 7 deletions static/styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
body {
background-color: #eeeeee;
background-color: #ea0079;
padding-left: 1em;
padding-right: 1em;
margin-left: 90px;
Expand All @@ -8,10 +8,11 @@ body {
h1, h2, h3 {
clear: both;
margin-top: 3em;
color: #0aec0a;
}

h1 a {
color: #bb8800;
color: #0aec0a;
}

nav ul {
Expand All @@ -26,12 +27,12 @@ nav ul {
}
nav ul li a {
display: block;
color: white;
background-color: #324b79;
color: rgb(0, 30, 255);
background-color: #7bff00;
border-radius: 25px 50px 0px;
padding: 1ex 2ex; }
nav ul li a:hover {
color: #324b72;
color: #5e12a6;
background-color: white;
}
nav img {
Expand All @@ -45,7 +46,7 @@ footer {
background-color: #ecc8f0; }

.login {
display: inline-block;
display: block;
float: right;
width: 30%;
border: orange solid 2px;
Expand All @@ -59,5 +60,28 @@ footer {
background-color: lightblue;
}


.flash{
display: block;
position: absolute;
left: 30%;
top: 1ex;
width: 40%;
border: 2px orange solid;
padding: 2ex;
border-radius: 20px;
font-weight: bold;
}
.error{
background-color: white;
color: red;
}
/*# sourceMappingURL=styles.css.map */

.url{
font-size: 150%;
}

.url input{
width: 75%;
font-size: 170%;
}
2 changes: 1 addition & 1 deletion templates/abc.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'base.html.j2' %}
{% extends 'base.html' %}


{% block obsah %}
Expand Down
28 changes: 28 additions & 0 deletions templates/banan.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

{% extends 'base.html' %}

{%block title%}Informace{%endblock%}

{% block obsah %}

<h1>Miluju banany, BMI</h1>

<p><img src="{{ url_for('static' , filename='banan.jpeg' ) }}" alt=""></p>
<h2>formulář</h2>
<form action="" method="get">
Hmotnost:<br><input type="number" name="hmotnost" placeholder="hmotnost v kg">kg <br>
Výška:<br><input type="number" name="výška" placeholder="výška v cm">cm <br>
<input type="submit" value="Vypočítej!">


</form>
<p>BMI={{bmi}}</p>








{% endblock obsah %}
34 changes: 32 additions & 2 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,33 @@

<body>
<a href="https://github.com/spseol/flask-start-onefile/"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>


<p class="login">

{% if 'uživatel' in session %}
jsi přihlášen jako <strong> Najvetší lupič</strong>
{% else %}
Jaaaaj!!! Nejsi přihlášen <a href="{{url_for('login')}}">Přihlas se!</a>
{% endif %}

</p>

{% for category,message in get_flashed_messages(with_categories=true) %}
<p class="flash {{category}}">
<button class="hide">X</button>
{{message}}
</p>
{% endfor %}
<nav>
<p><img src="{{ url_for('static', filename='flask-icon.png') }}" /></p>
<ul>
<li><a href="{{ url_for('index') }}">Index</a></li>
<li><a href="{{ url_for('info') }}">Info</a></li>
<li><a href="{{ url_for('abc') }}">ABC</a></li>
<li><a href="{{ url_for('banan') }}">banan</a></li>
<li><a href="{{ url_for('login') }}">Login</a></li>
<li><a href="{{ url_for('logout') }}">Logout</a></li>
<li><a href="{{ url_for('registr') }}">registr</a></li>
<li><a href="{{ url_for('zkracovac') }}">zkracovac</a></li>
</ul></nav>


Expand Down Expand Up @@ -58,7 +77,18 @@
</footer>


<script>

function hide(){
this.parentElement.style.display = "none"

}

var tlacitka = document.getElementsByClassName("hide");
for (var i=0; i<tlacitka.length; i++){
tlacitka[i].onclick = hide;
}
</script>

</body>
</html>
2 changes: 1 addition & 1 deletion templates/info.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'base.html.j2' %}
{% extends 'base.html' %}

{%block title%}Informace{%endblock%}

Expand Down
19 changes: 19 additions & 0 deletions templates/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends 'base.html' %}

{%block title%}Login{%endblock%}

{% block obsah %}

<h1>Login</h1>

<p>zde se mužeš přihlásit</p>
<form action=""method="post">
jméno: <br> <input type="text" name="jmeno"> <br>
heslo: <br>
<input type="password" name="heslo"> <br>
<br>
<input type="submit" value="Přihlas se frajere">


</form>
{% endblock obsah %}
32 changes: 32 additions & 0 deletions templates/pomerance.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% extends 'base.html' %}

{%block title%}Pomerance{%endblock%}

{% block obsah %}

<h1>BMI</h1>

<p><img src="{{ url_for('static', filename='pomeranc.jpeg')}}" alt=''></p>

<p>{%if bmi != None%}
"BMI" = {{bmi}}
{%else %}
<p>je treba zadat 2 nenulova cisla</p>
{%endif%}
</p>


<form action="" method = "GET">
<p>Hmotnost: <br>
<input type="number" name= "hmotnost" placeholder="Hmotnost kg"> kg </p>
<p>Výska: <br>

<input type="number" name="vyska" placeholder="Vyska cm"> cm </p>

<p><input type="submit" value="Vypocitej"></p>

</form>

<p> By Karel Z.</p>

{% endblock obsah %}
25 changes: 25 additions & 0 deletions templates/registr.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% extends 'base.html' %}

{%block title%}rgistrace{%endblock%}

{% block obsah %}

<h1>registrace</h1>

<p>zde se muzes registrovat</p>


<form action="", method="post">
jmeno <input type="text" name="jmeno"><br><br><br>
heslo <input type="password" name="heslo"><br><br><br>
heslo2 <input type="password" name="heslo2"><br><br><br>
<input type="submit" value="registrovat ">




</form>



{% endblock obsah %}
38 changes: 38 additions & 0 deletions templates/zkracovac.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{% extends 'base.html' %}

{%block title%}zkracovac{%endblock%}

{% block obsah %}

<h1>zkracovac URL</h1>


{% if new %}
<p>zkratka: <a href="{{new}}">{{new}}</a></p>

{% endif %}

<form method="post">

<p class="url">
Zadej URL: <input name="url" type="text">
<button type="submit">zkratit</button>
</p>


</form>

<h2>Seznam ulozenych zkratek</h2>

<ul>
{% for zkratka, adresa in zkratky %}

<li><a href="{{url_for('dezkracovac', zkratka=zkratka)}}"> {{ zkratka }}</a></li>
<li>{{ zkratka }} <a href="{{ adresa }}"> {{ adresa }}</a></li>
{% endfor %}
</ul>




{% endblock obsah %}
Loading