这两种配置运行 Django 有什么区别?
我有这两种配置。我想知道有什么区别,哪个更好更快?
第一个配置:
#!/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")
谢谢!
更新:
I have these two configurations. I would like to know what's the difference and which one is better and faster?
First configuration:
#!/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()
Second configuration:
#!/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")
Thanks!
Update:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Django 本身使用 WSGI,因此通过 FastCGI 运行它会为 HTTP 消息的传输添加另一层。话虽如此,如果您可以在快速的 FastCGI 容器或慢速的 WSGI 容器之间进行选择,那么使用额外的层可能会更好。
Django uses WSGI natively, so running it through FastCGI adds another layer for the HTTP messages to travel through. Having said that, if you have the choice between a quick FastCGI container or a slow WSGI container, you may be better off living with the extra layer.