开发者

What is the difference between these two configurations to run Django?

开发者 https://www.devze.com 2023-04-11 18:11 出处:网络
I have these two configurations. I would like to know what\'s the difference and which one is better and faster?

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:

I did a quick test with python cProfile lib.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号