在共享主机上建立金字塔网络框架| FCGI

2024-04-26 20:41:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我如何在我的~/public_html中创建一个简单的FCGI程序,它将被执行,将web请求发送到我的金字塔网站?在

在django中,使用下面的代码对我很好:

#!/usr/local/bin/python2.6

import sys
import os

sys.path.append('/home/username/local/lib/python2.6/site-packages')

os.environ['DJANGO_SETTINGS_MODULE'] = 'myproj.settings'

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

我现在卡住了。顺便说一句,这是我学习金字塔的第二天。在


Tags: django代码import程序webbinos网站
1条回答
网友
1楼 · 发布于 2024-04-26 20:41:45

我自己并没有使用过FastCGI,但是将基于Paster的WSGI应用程序连接到FastCGI的指南应该是相同的(例如挂架、涡轮齿轮、金字塔,都使用Paster for WSGI)。在

我发现对我来说有意义的指南在:http://turbogears.org/2.1/docs/main/Deployment/FastCGI.html

挂接任何基于粘贴器的wsgi应用程序的关键是调度.fcgi文件。。。在

#!/usr/bin/env python
myapp = '/usr/local/myapp'
inifile = 'production.ini'
import sys, os
sys.path.insert(0, myapp)
from paste.deploy import loadapp
wsgi_app = loadapp('config:' + myapp + '/' + inifile
if __name__ == '__main__':
    from flup.server.fcgi import WSGIServer
    WSGIServer(wsgi_app).run()

相关问题 更多 >