1

How can I create a simple FCGI program in my ~/public_html that will be executed that will dispatch web requests to my pyramid website?

In django, using the code below works fine for me:

#!/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")

I'm stuck at the moment. By the way, This is my 2nd day in learning pyramid.

4

1 回答 1

1

我自己没有使用过 FastCGI,但是将基于 Paster 的 WSGI 应用程序连接到 FastCGI 的指南应该是相同的(即 Pylons、TurboGears、Pyramid,都使用 Paster for WSGI)。

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

挂钩任何基于 Paster 的 wsgi 应用程序的关键是 dispatch.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()
于 2011-03-06T17:15:09.213 回答