Skip to content

Commit 00ff33c

Browse files
committed
finished days1-4; blank doc for days5-8
1 parent b00e969 commit 00ff33c

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

days/001-004-flask-intro/code/program/routes.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from datetime import datetime
22
from flask import render_template
33
from program import app
4+
import os
45

56
@app.route('/')
67
@app.route('/index')
@@ -10,3 +11,20 @@ def index():
1011
@app.route('/100Days')
1112
def p100days():
1213
return render_template('100Days.html')
14+
15+
@app.route('/truck')
16+
def truck_status():
17+
pidfile = "/tmp/truck.pid"
18+
if os.path.isfile(pidfile):
19+
with open(pidfile, 'r') as f:
20+
otherID = f.read()
21+
status = f'running with ID {otherID}'
22+
else:
23+
status = 'not running'
24+
os.system('/usr/bin/python3 /home/pi/truck/truck_mainRC.py')
25+
26+
return render_template('truck.html', title='Truck Status', status=status)
27+
28+
@app.route('/secret')
29+
def secret():
30+
return render_template('secret.html')

days/001-004-flask-intro/code/program/templates/base.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@
1111
<div class="mui-panel">Menu Bar -
1212
<button class="mui-btn mui-btn--raised"><a href="/index">Home</a></button>
1313
<button class="mui-btn mui-btn--raised"><a href="/100Days">100 Days</a></button>
14+
<button class="mui-btn mui-btn--raised"><a href="/truck">Truck</a></button>
15+
<button class="mui-btn mui-btn--raised"><a href="/secret">SECRET!</a></button>
16+
<div class="mui-dropdown">
17+
<button class="mui-btn mui-btn--primary" data-mui-toggle="dropdown">
18+
Dropdown
19+
<span class="mui-caret"></span>
20+
</button>
21+
<ul class="mui-dropdown__menu">
22+
<li><a href="#">Option 1</a></li>
23+
<li><a href="#">Option 2</a></li>
24+
<li><a href="#">Option 3</a></li>
25+
<li><a href="#">Option 4</a></li>
26+
</ul>
27+
</div>
1428
</div>
1529
<hr>
1630
{% block content %}{% endblock %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{% extends "base.html" %}
2+
3+
{% block content %}
4+
<h1>Secret message: CP loves VP VERY MUCH!</h1>
5+
<p>Will you be my girlfriend?</p>
6+
{% endblock %}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% extends "base.html" %}
2+
3+
{% block content %}
4+
<h1>Hello! The Truck Daemon is {{ status }}</h1>
5+
{% endblock %}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<head>
3+
<title>Geegle</title>
4+
</head>
5+
6+
<body>
7+
8+
<div style="text-align: center; margin-bottom: 10px;">
9+
<img src="google-1998-marked-up.png" alt="">
10+
</div>
11+
12+
</body>

0 commit comments

Comments
 (0)