在 Elastic Beanstalk 中使用 CherryPy 部署 python

Deploying python using CherryPy in Elastic Beanstalk

我是 python 的新手。我必须 运行 来自 Amazon Cloud 的 python 应用程序。我正在使用 CherryPy 并通过 Beanstalk 进行部署。这是我简单的 HelloWorld 代码

import cherrypy

class Hello(object):
    @cherrypy.expose
    def index(self):
        return "Hello world!"

if __name__ == '__main__':
    cherrypy.config.update({'server.socket_host': '0.0.0.0',
                            'server.socket_port': 80,})
    cherrypy.quickstart(Hello())

requirements.txt 文件中我有 CherryPy==10.2.2。不过,我无法在 beantalk URL 中看到任何输出。部署时出现以下错误,

Your WSGIPath refers to a file that does not exist.

任何人都可以提供任何见解吗?

问题是 软件配置 中的 WSGIPath 变量将 application.py 指定为初始文件。上面代码中的 Hello class 在一个不同名称的文件中。

确保初始代码位于名为 application.py 的文件中或更改配置。