mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-06 13:41:28 +00:00
you can do RPC from uwsgicc
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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'))
|
||||
|
||||
Reference in New Issue
Block a user