在生产中使用nginx + Apache + mod_wsgi与nginx + uWSGI(vurtualenv)有什么优缺点
使用i的第一个变体的优点我看到自2007年以来开发的mod_wsgi,并且具有更稳定的版本和易于管理
第二种变体的优点是性能更高(参见Python WSGI服务器的基准,可以在virtualenv中使用更安全的uWSGI服务器.
第二个变体的缺点是仍然没有主要版本,需要创建一些控制脚本来为每个虚拟主机启动uWSGI服务器(或使用主管)
你怎么看待它?
如何确定引发了什么函数异常.例如,存在两个函数:'foo'和'bar'.在'foo'中,异常将随机提出.
import random
def foo():
if random.randint(1, 10) % 2:
raise Exception
bar()
def bar():
raise Exception
try:
foo()
except Exception as e:
print "Exception raised in %s" % ???
Run Code Online (Sandbox Code Playgroud)