Server IP : 85.214.239.14 / Your IP : 18.118.184.36 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/root/proc/self/root/usr/share/doc/uwsgi-core/tests/ |
Upload File : |
# uwsgi --queue 10 --queue-store test.queue --master --module tests.queue --socket :3031 import uwsgi import os from flask import Flask,render_template,request,redirect,flash app = Flask(__name__) app.debug = True app.secret_key = os.urandom(24) @app.route('/') def index(): return render_template('queue.html', uwsgi=uwsgi) @app.route('/push', methods=['POST']) def push_item(): if uwsgi.queue_push(request.form['body']): flash('item enqueued') return redirect('/') else: flash('unable to enqueue item') return render_template('queue.html', uwsgi=uwsgi) @app.route('/get', methods=['POST']) def get_item(): flash( "slot %s value = %s" % (request.form['slot'], uwsgi.queue_get( int(request.form['slot']) ))) return redirect('/') @app.route('/pop', methods=['POST']) def pop_item(): flash( "popped value = %s" % uwsgi.queue_pop() ) return redirect('/') @app.route('/pull', methods=['POST']) def pull_item(): flash( "pulled value = %s" % uwsgi.queue_pull() ) return redirect('/') @app.route('/set', methods=['POST']) def set_item(): if uwsgi.queue_set(int(request.form['pos']), request.form['body']): flash('item set') return redirect('/') else: flash('unable to set item') return render_template('queue.html', uwsgi=uwsgi)