Hi,
I am using uWSGI 2.0.1 with flask and requests.
Is the below code blocking when using the gevent loop? How do I do a yield
inf flask? and and can the requests lib be monkey patched?
Thanks
from gevent import monkey; monkey.patch_all()
import gevent
import gevent.socket
from flask import render_template,flash, redirect,request, url_for, g,
session,flash, jsonify,Response,jsonify,make_response,send_file
from flask.ext.login import login_user, logout_user, current_user,
login_required, UserMixin,confirm_login,fresh_login_required
from flask.ext import restful
from flask.ext.restful import reqparse, abort, Api, Resource
import sys
from yaml import load, Loader
try:
import uwsgi
except:
pass
import traceback
import sys
import os
import requests
try:
from app import app #, login_manager
except:
print 'ImportError: No module named app'
def fetch_url(url):
r = requests.get(url)
return r.status_code
@app.route('/test')
def test():
"""
when run with the uWSGI gevent loop ....while the web page is being
fetched
other requests will be accepted. This increased thoughput. THe is one
proccess per core.
Need more scale..add more cores....................
QED.....
"""
url = 'http://www.cnn.com'
jt = gevent.spawn(fetch_url,url)
jt.join()
status = jt.value
return render_template("test.html",title = 'Home', status=status)
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi