1

複雑なdjangoアプリケーションを既存のツイストサーバーに追加/提供しようとしています(既存のツイストサーバーは、少なくとも標準ポートではhttpサービスを提供しないため、この作業にはポート80を使用できます)。

これまでに見つけた例はすべて、Twisted の以前のバージョンのものであり、最新バージョンではそのままでは機能しないようです。

最新バージョンの twisted を介して複雑な Django アプリケーションを提供するための正しい配線を示す、最新のチュートリアル、一連の例、またはレシピはどこにありますか?


より具体的には、次の小さな宣伝文句に近づきました。

from twisted.web.resource import Resource
from twisted.web import wsgi
from twisted.internet import reactor
from django.core.handlers.wsgi import WSGIHandler
os.environ['DJANGO_SETTINGS_MODULE'] = 'app.settings'
django_application = WSGIHandler()
django_resource = wsgi.WSGIResource(reactor, reactor.getThreadPool(), django_application)

root = Resource()
root.putChild("",django_resource)
from twisted.application import service
application = service.Application("app")

internet.TCPServer(8080, Site(root)).setServiceParent(application)

(それは私の django プロジェクトの基本的なコンテンツを提供しますが、静的コンテンツを適切に提供できないようであり、プロジェクト内のサブディレクトリで提供される django アプリケーションを自動的に処理しないようです)

4

1 に答える 1