Skip to content

Commit 1a46929

Browse files
committed
PCC15
1 parent 0d6de31 commit 1a46929

File tree

6 files changed

+77
-0
lines changed

6 files changed

+77
-0
lines changed

15/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.db

15/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Code Challenge 15 - Create a Simple Flask App
2+
3+
Instructions [here](http://pybit.es/codechallenge15.html).
4+
5+
Previous challenges and About [here](http://pybit.es/pages/challenges.html).

15/app.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from flask import Flask, render_template
2+
3+
# persistence
4+
#
5+
# could go with serialization
6+
# import shelve
7+
# or:
8+
# import pickle
9+
#
10+
# could go with stdlib DB
11+
# import sqlite3
12+
13+
# could go with ORM
14+
# $ pip install flask_sqlalchemy
15+
# add:
16+
# from flask_sqlalchemy import SQLAlchemy
17+
18+
app = Flask(__name__)
19+
20+
21+
@app.route('/')
22+
def index():
23+
pass
24+
25+
26+
if __name__ == '__main__':
27+
app.run(debug=True)

15/requirements.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
click==6.7
2+
Flask==0.12.1
3+
itsdangerous==0.24
4+
Jinja2==2.9.6
5+
MarkupSafe==1.0
6+
Werkzeug==0.12.1

15/static/style.css

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* some styles, add/update/delete as you want */
2+
3+
body {
4+
text-align: center;
5+
}
6+
7+
.centered {
8+
margin: auto;
9+
width: 20%;
10+
}
11+
12+
.thick-border {
13+
border: 3px solid black;
14+
border-collapse: collapse;
15+
}
16+
17+
th, td {
18+
border: 1px solid black;
19+
border-collapse: collapse;
20+
}

15/templates/template.html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!doctype html>
2+
3+
<!-- some boilerplate, delete or modify as you wish -->
4+
5+
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
6+
7+
<table class="centered thick-border">
8+
<tr>
9+
<th>col1</th>
10+
<th>col2</th>
11+
</tr>
12+
{% for k, v in data.items() %}
13+
<tr>
14+
<td>{{ k }}</td>
15+
<td>{{ v }}</td>
16+
</tr>
17+
{% endfor %}
18+
</table>

0 commit comments

Comments
 (0)