如何在 AWS 弹性 beantalk 上部署结构化 Flask 应用程序 [英] How to deploy structured Flask app on AWS elastic beanstalk

查看:25
本文介绍了如何在 AWS 弹性 beantalk 上部署结构化 Flask 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此处概述的步骤成功部署测试应用后:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_flask.html

After successfully deploying a test app using the steps outlined here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python_flask.html

我尝试部署具有以下结构的实际烧瓶应用程序:

I tried to deploy my actual flask application which has the following structure:

myApp/
   runServer.py
   requirements.txt
   myApp/
      __init__.py
      helpers.py
      clean.sh
      static/
         myApp.css
      handlers/
         __init__.py
         views.py
      templates/
         layout.html
         viewOne.html
         viewTwo.html

其中 views.py 包含我的 url 映射.

Where views.py contains my url mappings.

我尝试在根目录以及 myApp 模块和 git aws.push 中初始化 eb 实例,但我得到AWS 仪表板上的以下错误:错误您的 WSGIPath 引用了一个不存在的文件. 并且应用程序不起作用(任何路径都为 404).

I have tried initializing the eb instance in the root directory as well as within the myApp module and git aws.push but I get the following error on the AWS dashboard: ERROR Your WSGIPath refers to a file that does not exist. and the application does not work (404 for any path).

如何将上述 Flask 应用程序部署到弹性 beanstalk?

How can I deploy the above Flask application to elastic beanstalk?

推荐答案

将以下内容添加到 .ebextensions/.config:

option_settings:
  "aws:elasticbeanstalk:container:python":
    WSGIPath: myApp/handlers/views.py

更新:

如果您没有 .ebextensions 目录,请为项目创建一个.您可以在 自定义和配置 AWS Elastic 中找到有关容器配置的更多信息Beanstalk 环境 指南.

If you don't have .ebextensions directory, please create one for the project. You can find more information of what can be done regarding the container configuration in Customizing and Configuring AWS Elastic Beanstalk Environments guide.

这篇关于如何在 AWS 弹性 beantalk 上部署结构化 Flask 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆