you can do RPC from uwsgicc

This commit is contained in:
roberto@sirius
2011-01-04 17:42:48 +01:00
parent 6e748eafb9
commit e176af1702
2 changed files with 34 additions and 1 deletions
+16 -1
View File
@@ -138,7 +138,7 @@ a:hover{
<h1>uWSGI <span class="small">{{uwsgi.version}}</span> Control Center</h1>
<div class="anchor">
<a href="#information">information</a> | <a href="#options">options</a> | <a href="#logs">logs</a> | <a href="#workers">workers</a> {% if uwsgi.cluster() %}| <a href="#cluster">cluster</a>{% endif %}
<a href="#information">information</a> | <a href="#options">options</a> | <a href="#logs">logs</a> | <a href="#workers">workers</a> | <a href="#rpc">rpc</a> {% if uwsgi.cluster() %}| <a href="#cluster">cluster</a>{% endif %}
</div>
{% with messages = get_flashed_messages() %}
@@ -225,6 +225,21 @@ a:hover{
</div>
<a name="rpc"></a>
<h3>RPC</h3>
<div class="info">
<form method="POST" action="/rpc">
<b>node address (leave empty for local rpc):</b> <input type="text" name="node" /> <b>function:</b> <input type="text" name="func" /> <b>args (separated by space, optional):</b> <input type="text" name="args" /> <input type="submit" value="call" /><br/>
</form>
<br/>
<div class="anchor">
<a href="#top">back to top</a>
</div>
</div>
{% if uwsgi.cluster() %}
<a name="cluster"></a>
+18
View File
@@ -21,3 +21,21 @@ def log():
uwsgi.log(request.form['message'])
flash("log message written")
return redirect(url_for('index'))
@app.route("/rpc", methods=['POST'])
def log():
node = str(request.form['node'])
if node == '':
node = None
fargs = str(request.form['args'])
args = fargs.split()
if len(args) > 0:
ret = uwsgi.rpc(str(node), str(request.form['func']), *map(str, args))
else:
ret = uwsgi.rpc(str(node), str(request.form['func']))
flash("rpc \"%s\" returned: %s" % (request.form['func'], ret) )
return redirect(url_for('index'))