我有这两种配置。我想知道有什么区别,哪个更好更快?
第一个配置:
#!/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")
谢谢!
更新:
最佳答案
Django native 使用 WSGI,因此通过 FastCGI 运行它为 HTTP 消息传输增加了另一层。话虽如此,如果您可以在快速的 FastCGI 容器或慢速的 WSGI 容器之间做出选择,您最好还是使用额外的层。
关于python - 这两种运行 Django 的配置有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7690839/