start work
This commit is contained in:
parent
6ca0ab77b9
commit
e1ccd33636
3 changed files with 45 additions and 0 deletions
13
app/app.py
Normal file
13
app/app.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
from flask import Flask, render_template, make_response, send_from_directory
|
||||||
|
import os
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def index():
|
||||||
|
return render_template('index.xht')
|
||||||
|
|
||||||
|
@app.route('/fortune')
|
||||||
|
def fortune():
|
||||||
|
fortune = os.run('/usr/bin/fortune')
|
||||||
|
return render_template('fortune.j2', fortune=fortune)
|
15
app/templates/fortune.j2
Normal file
15
app/templates/fortune.j2
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<title>fortune as a service</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>fortune as a service</h1>
|
||||||
|
<p>
|
||||||
|
your fortune is: {{ fortune }}
|
||||||
|
</p>
|
||||||
|
<a href="/fortune">get a new fortune</a>
|
||||||
|
</body>
|
17
app/templates/index.xht
Normal file
17
app/templates/index.xht
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head>
|
||||||
|
<title>fortune as a service</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>fortune as a service</h1>
|
||||||
|
<p>
|
||||||
|
fortune as a service is a simple web application that provides random fortunes,
|
||||||
|
from the /usr/bin/fortune command on Arch Linux, with our patent-pending AI Layer
|
||||||
|
2 code execution engine.
|
||||||
|
</p>
|
||||||
|
<a href="/fortune">get a fortune</a>
|
||||||
|
</body>
|
Loading…
Add table
Reference in a new issue