目标WSGI脚本'/opt/python/current/app/application.py';不包含WSGI应用程序';应用程序';
把我的头发拔出来!我正在尝试将Python FLask应用程序部署到AWS Elastic Beanstalk,但我发现了错误 目标WSGI脚本“/opt/python/current/app/application.py”不包含WSGI应用程序“application” 该网页刚刚返回一个500服务器错误 my application.py的内容如下:目标WSGI脚本'/opt/python/current/app/application.py';不包含WSGI应用程序';应用程序';,python,amazon-web-services,flask,amazon-elastic-beanstalk,Python,Amazon Web Services,Flask,Amazon Elastic Beanstalk,把我的头发拔出来!我正在尝试将Python FLask应用程序部署到AWS Elastic Beanstalk,但我发现了错误 目标WSGI脚本“/opt/python/current/app/application.py”不包含WSGI应用程序“application” 该网页刚刚返回一个500服务器错误 my application.py的内容如下: #!/usr/bin/env python3 import connexion if __name__ == '__main__':
#!/usr/bin/env python3
import connexion
if __name__ == '__main__':
application = connexion.App(__name__, specification_dir='./swagger/')
application.add_api('swagger.yaml', arguments={'title': 'This is a basic API fascade to theprotptype development robot. The API front-ends the communication with an MQTT pub/sub topic, which uses the Amazon Web Services IoT service.'})
application.run()
本地运行良好,但上传到AWS时效果不佳。我已将名称从app.py更改为application.py,并将app=更改为application=但没有更改
不知道下一步要去哪里:(如果
应用程序=…
之后的,因为启动器可能会导入脚本而不是执行它。在这种情况下,\uuuu name\uuuuuuuuuu
将不会被定义为\uuuu main\uuuuuuu
。请参阅此示例
application = connexion.App(__name__, specification_dir='./swagger/')
application.add_api('swagger.yaml', arguments={'title': 'This is a basic API fascade to theprotptype development robot. The API front-ends the communication with an MQTT pub/sub topic, which uses the Amazon Web Services IoT service.'})
if __name__ == '__main__':
application.run()
谢谢,这使它向前移动了,现在它通过了,并且失败了,因为'AttributeError:'module'对象没有属性'default_controller':):(似乎您的本地包与AWS上的包版本不同。请检查这些相关包的版本号。