我有这两种配置。我需要知道有什么不同,哪一个更好更快?
第一种形态:
#!/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")
谢谢:D
更新:
I did a quick test with python cProfile lib。在文档中,WSGI对应于第一个conf,FCGI对应于第二个conf。
最佳答案
Django本机使用WSGI,因此通过FastCGI运行它会为HTTP消息添加另一层。话虽如此,如果您可以在快速的FastCGI容器或慢速的WSGI容器之间进行选择,那么最好使用额外的层。
关于python - 这两种运行Django的配置有何区别?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7690839/