File tree Expand file tree Collapse file tree 5 files changed +55
-0
lines changed
001-004-flask-intro/code/program Expand file tree Collapse file tree 5 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 1
1
from datetime import datetime
2
2
from flask import render_template
3
3
from program import app
4
+ import os
4
5
5
6
@app .route ('/' )
6
7
@app .route ('/index' )
@@ -10,3 +11,20 @@ def index():
10
11
@app .route ('/100Days' )
11
12
def p100days ():
12
13
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' )
Original file line number Diff line number Diff line change 11
11
< div class ="mui-panel "> Menu Bar -
12
12
< button class ="mui-btn mui-btn--raised "> < a href ="/index "> Home</ a > </ button >
13
13
< 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 >
14
28
</ div >
15
29
< hr >
16
30
{% block content %}{% endblock %}
Original file line number Diff line number Diff line change
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 %}
Original file line number Diff line number Diff line change
1
+ {% extends "base.html" %}
2
+
3
+ {% block content %}
4
+ < h1 > Hello! The Truck Daemon is {{ status }}</ h1 >
5
+ {% endblock %}
Original file line number Diff line number Diff line change
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 >
You can’t perform that action at this time.
0 commit comments