Docker和WSGI与Python Pyramid应用程序?

问题描述 投票:0回答:1

我正在看两篇关于如何Dockerize金字塔应用程序的文章。我对Python并不熟悉,但我相当确定你需要使用WSGI的Pyramid应用程序。

本文使用WSGI:https://medium.com/@greut/minimal-python-deployment-on-docker-with-uwsgi-bc5aa89b3d35

这个直接运行python可执行文件:https://runnable.com/docker/python/dockerize-your-pyramid-application

我似乎不太可能直接运行python并且不包含WSGI,任何人都可以解释为什么runnable.com文章的docker解决方案可以工作吗?

python docker pyramid
1个回答
2
投票

根据second link中的脚本:

from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response

~snip~

if __name__ == '__main__':
    config = Configurator()
    config.add_route('hello', '/')
    config.add_view(hello_world, route_name='hello')
    app = config.make_wsgi_app() # The wsgi server is configured here
    server = make_server('0.0.0.0', 6543, app) # and here

This包含为什么在if __name__=="__main__"块中构建wsgi服务器的解释

© www.soinside.com 2019 - 2024. All rights reserved.