簡體   English   中英

這兩種配置運行 Django 有什么區別?

[英]What is the difference between these two configurations to run 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")

謝謝!

更新:

我用 python cProfile lib 做了一個快速測試

Django 本身使用 WSGI,因此通過 FastCGI 運行它會為 HTTP 消息添加另一層以通過它。 話雖如此,如果您可以在快速 FastCGI 容器或慢速 WSGI 容器之間做出選擇,那么您最好使用額外的層。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM