3

我有这两种配置。我想知道有什么区别,哪个更好更快?

第一个配置:

#!/home/user/bin/python
import sys, os
sys.path.insert(0,"/home/user/projects/")
os.environ['DJANGO_SETTINGS_MODULE'] = 'django_project.settings'

from flup.server.fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
WSGIServer(WSGIHandler()).run()

第二种配置:

#!/home/user/bin/python
import sys, os
sys.path.insert(0,"/home/user/projects/")
os.environ['DJANGO_SETTINGS_MODULE'] = 'django_project.settings'

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

谢谢!

更新:

我用 python cProfile lib 做了一个快速测试

4

1 回答 1

1

Django 原生使用 WSGI,因此通过 FastCGI 运行它为 HTTP 消息的传输增加了另一层。话虽如此,如果您可以在快速 FastCGI 容器或慢速 WSGI 容器之间进行选择,那么使用额外的层可能会更好。

于 2011-10-07T17:40:40.467 回答