From e1daf1d360bd7ea91ee608d543daa8b83cc9b558 Mon Sep 17 00:00:00 2001 From: "roberto@sirius" Date: Sat, 1 Jan 2011 12:42:17 +0100 Subject: [PATCH] add skel version of the uWSGI Control Center (flask+jinja2 app) --- uwsgicc/__init__.py | 3 ++ uwsgicc/templates/index.html | 74 ++++++++++++++++++++++++++++++++++++ uwsgicc/uwsgicc.py | 14 +++++++ 3 files changed, 91 insertions(+) create mode 100644 uwsgicc/__init__.py create mode 100644 uwsgicc/templates/index.html create mode 100644 uwsgicc/uwsgicc.py diff --git a/uwsgicc/__init__.py b/uwsgicc/__init__.py new file mode 100644 index 00000000..f2ce560d --- /dev/null +++ b/uwsgicc/__init__.py @@ -0,0 +1,3 @@ +from uwsgicc import app + +application = app diff --git a/uwsgicc/templates/index.html b/uwsgicc/templates/index.html new file mode 100644 index 00000000..27b9c077 --- /dev/null +++ b/uwsgicc/templates/index.html @@ -0,0 +1,74 @@ +

uWSGI {{uwsgi.version}} Control Center

+ +nodename: {{uwsgi.cluster_node_name()}}
+mode: {{uwsgi.mode}}
+started_on: {{uwsgi.started_on|unixtime}}
+workers: {{uwsgi.numproc}}
+masterpid: {{uwsgi.masterpid()}}
+cluster: {{uwsgi.cluster()}}
+ +

options

+{% for k in uwsgi.opt.keys() %} + {{k}}={{uwsgi.opt[k]}}
+{% endfor %} + +

workers

+ +{% for w in uwsgi.workers() %} + + + + + + +{% endfor %} +
{{w.id}}{{w.pid}}{{w.requests}}{{w.respawn_count}}
+ +

cluster nodes

+best is {{ uwsgi.cluster_best_node() }}

+
+ +
+
+ + +
+ +
+ + +
+
+ +{% for ucn in uwsgi.cluster_nodes() %} + + + + + + + + + + + + + + + +{% endfor %} +
{{ uwsgi.cluster_node_name(ucn) }}{{ ucn }}
+ + + +
+ + + +
+ + +
+ + +

diff --git a/uwsgicc/uwsgicc.py b/uwsgicc/uwsgicc.py new file mode 100644 index 00000000..60c27d4a --- /dev/null +++ b/uwsgicc/uwsgicc.py @@ -0,0 +1,14 @@ +import uwsgi +from flask import Flask, render_template +import time + +app = Flask(__name__) + +@app.template_filter('unixtime') +def unixtime(s): + return time.strftime("%d/%m/%Y %H:%M:%S", time.localtime(s)) + + +@app.route("/") +def index(): + return render_template("index.html", uwsgi=uwsgi)