setup the first workflow
commit
e398678b0b
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>I am a HTML page fillllllled with data, such as the b'up 1 week, 6 hours, 32 minutes\n'</h1>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,26 @@
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
## Getting the data
|
||||
import subprocess
|
||||
|
||||
#subprocess.run(["ls", "-l"])
|
||||
#print(os.popen("ls -l").read())
|
||||
thing = subprocess.run(["uptime", "-p"], capture_output=True)
|
||||
print(thing.stdout)
|
||||
|
||||
## Creating the HTML
|
||||
|
||||
# loading the environment
|
||||
env = Environment(loader = FileSystemLoader('templates'))
|
||||
|
||||
# loading the template
|
||||
template = env.get_template('template.jinja')
|
||||
|
||||
# rendering the template and storing the resultant text in variable output
|
||||
output = template.render(uptime = thing.stdout)
|
||||
|
||||
# printing the output on screen
|
||||
print(output)
|
||||
with open("renders/output.html", 'w') as f:
|
||||
print(output, file = f)
|
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>I am a HTML page fillllllled with data, such as the {{ uptime }}</h1>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue