summaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
Diffstat (limited to 'code')
-rwxr-xr-xcode/templates/flask/app.py48
-rw-r--r--code/templates/flask/static/favicon.ico0
-rw-r--r--code/templates/flask/static/robots.txt2
-rw-r--r--code/templates/flask/templates/base.html13
-rw-r--r--code/templates/flask/templates/home.html4
5 files changed, 67 insertions, 0 deletions
diff --git a/code/templates/flask/app.py b/code/templates/flask/app.py
new file mode 100755
index 0000000..69d3c54
--- /dev/null
+++ b/code/templates/flask/app.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+import os
+import argparse
+from flask import Flask, render_template, send_from_directory, request, \
+ url_for, abort, flash, session, g, redirect
+
+app = Flask(__name__)
+app.config.from_object(__name__)
+
+@app.route('/', methods=['GET'])
+def homepage():
+ return render_template('home.html')
+
+@app.route('/favicon.ico', methods=['GET'])
+def favicon():
+ """ Simple static redirect """
+ return send_from_directory(os.path.join(app.root_path, 'static'),
+ 'favicon.ico',
+ mimetype='image/vnd.microsoft.icon')
+
+@app.route('/robots.txt', methods=['GET'])
+def robots():
+ """ "Just in case?" """
+ return send_from_directory(os.path.join(app.root_path, 'static'),
+ 'robots.txt',
+ mimetype='text/plain')
+
+#############################################################################
+def main():
+ """Primary entry-point for torouterui.
+ """
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--debug',
+ action='store_true',
+ help="enable debugging interface")
+ parser.add_argument('--host',
+ default="127.0.0.1",
+ help="listen on this host/IP")
+ parser.add_argument('--port',
+ type=int,
+ default=5050,
+ help="listen on this port")
+ args = parser.parse_args()
+ app.run(debug=args.debug, host=args.host, port=args.port)
+
+if __name__ == '__main__':
+ main()
diff --git a/code/templates/flask/static/favicon.ico b/code/templates/flask/static/favicon.ico
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/code/templates/flask/static/favicon.ico
diff --git a/code/templates/flask/static/robots.txt b/code/templates/flask/static/robots.txt
new file mode 100644
index 0000000..fc5f235
--- /dev/null
+++ b/code/templates/flask/static/robots.txt
@@ -0,0 +1,2 @@
+
+blah!
diff --git a/code/templates/flask/templates/base.html b/code/templates/flask/templates/base.html
new file mode 100644
index 0000000..1a3935f
--- /dev/null
+++ b/code/templates/flask/templates/base.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<html>
+<head>
+ <title>flask app template</title>
+ <!-- <link href="/static/css/default.css" rel="stylesheet"> -->
+ <style type="text/css">
+ <!-- local style here -->
+ </style>
+</head>
+<body>
+{% block body %}{% endblock %}
+</body>
+</html>
diff --git a/code/templates/flask/templates/home.html b/code/templates/flask/templates/home.html
new file mode 100644
index 0000000..9825deb
--- /dev/null
+++ b/code/templates/flask/templates/home.html
@@ -0,0 +1,4 @@
+{% extends "base.html" %}
+{% block body %}
+<h1>template flask app</h1>
+{% endblock %}