diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index cbf6b6b5..e151f6c3 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -533,6 +533,18 @@ void uwsgi_uwsgi_config(char *module) { exit(1); } + if (PyDict_SetItemString(up.embedded_dict, "cores", PyInt_FromLong(uwsgi.cores))) { + PyErr_Print(); + exit(1); + } + + if (uwsgi.loop) { + if (PyDict_SetItemString(up.embedded_dict, "loop", PyString_FromString(uwsgi.loop))) { + PyErr_Print(); + exit(1); + } + } + if (PyDict_SetItemString(up.embedded_dict, "KIND_NULL", PyInt_FromLong(KIND_NULL))) { PyErr_Print(); exit(1);} if (PyDict_SetItemString(up.embedded_dict, "KIND_WORKER", PyInt_FromLong(KIND_WORKER))) { PyErr_Print(); exit(1);} if (PyDict_SetItemString(up.embedded_dict, "KIND_EVENT", PyInt_FromLong(KIND_EVENT))) { PyErr_Print(); exit(1);} diff --git a/uwsgicc/templates/index.html b/uwsgicc/templates/index.html index 27b9c077..cb47d8a6 100644 --- a/uwsgicc/templates/index.html +++ b/uwsgicc/templates/index.html @@ -1,9 +1,21 @@

uWSGI {{uwsgi.version}} Control Center

+{% with messages = get_flashed_messages() %} + {% if messages %} +
+ {% for message in messages %} +
  • {{ message }}
  • + {% endfor %} +
    + {% endif %} +{% endwith %} + nodename: {{uwsgi.cluster_node_name()}}
    mode: {{uwsgi.mode}}
    +loop: {{uwsgi.loop}}
    started_on: {{uwsgi.started_on|unixtime}}
    workers: {{uwsgi.numproc}}
    +cores: {{ uwsgi.cores }}
    masterpid: {{uwsgi.masterpid()}}
    cluster: {{uwsgi.cluster()}}
    @@ -12,6 +24,13 @@ {{k}}={{uwsgi.opt[k]}}
    {% endfor %} +
    +
    + + +
    +
    +

    workers

    {% for w in uwsgi.workers() %} @@ -24,6 +43,8 @@ {% endfor %}
    + +{% if uwsgi.cluster() %}

    cluster nodes

    best is {{ uwsgi.cluster_best_node() }}

    @@ -71,4 +92,4 @@ -

    +{% endif %} diff --git a/uwsgicc/uwsgicc.py b/uwsgicc/uwsgicc.py index 60c27d4a..3f9561f7 100644 --- a/uwsgicc/uwsgicc.py +++ b/uwsgicc/uwsgicc.py @@ -1,8 +1,11 @@ import uwsgi -from flask import Flask, render_template +from flask import Flask, render_template, request, url_for, redirect, flash import time +import os app = Flask(__name__) +app.debug = True +app.secret_key = os.urandom(24) @app.template_filter('unixtime') def unixtime(s): @@ -12,3 +15,9 @@ def unixtime(s): @app.route("/") def index(): return render_template("index.html", uwsgi=uwsgi) + +@app.route("/log", methods=['POST']) +def log(): + uwsgi.log(request.form['message']) + flash("log message written") + return redirect(url_for('index'))