将Flask应用程序部署到AWS Elastic Beanstalk:"错误:您的WSGIPath引用的文件不存在。"

时间:2018-04-09 22:06:31

标签: python amazon-web-services flask elastic-beanstalk

我正在努力使用Elastic Beanstalk将flask-app部署到AWS。它在本地部署良好,但在我尝试推送到EB时会出错。

在阅读joshmcode的回答here后,我将烧瓶应用名称从传统的app更改为application,将我的文件名更改为application.py,并确保Elastic Beanstalk配置文件匹配。这并没有解决问题。

我的eb config文件的相关部分:

aws:elasticbeanstalk:container:python:
NumProcesses: '1'
NumThreads: '15'
StaticFiles: /static/=static/
WSGIPath: application.py

我的文件结构:

在FlaskAWS文件夹中,我有根烧瓶目录(" flask-chatterbot")和虚拟环境,如:

venv 
flask-chatterbot
    -requirements.txt
    -application.py
    Templates 
        -index.html
    Static
        css
           -styles.css
        js 
           -dynam.js

错误前的命令:

  1. 在本地成功部署后,我用

    冻结了包的要求

    pip freeze> requirements.txt

  2. 然后停用虚拟环境

    停用

  3. 使用eb init命令

    初始化CLI存储库

    eb init -p python example-chatbot

  4. 此时,我选择了Python的版本并设置了SSH密钥而没有任何问题。

    4)之后我跑了

    eb create flask-environ 
    

    我收到以下错误:

    MacBook-Air:flaskaws patrickharris$ eb create flask-environ
    Creating application version archive "app-180409_132356".
    Uploading flask-app/app-180409_132356.zip to S3. This may take a while.
    Upload Complete.
    Environment details for: flask-environ
      Application name: flask-app
      Region: us-west-1
      Deployed Version: app-180409_132356
      Environment ID: xxxidxxx
      Platform: arn:aws:elasticbeanstalk:us-west-1::platform/Python 2.6 running on 64bit Amazon Linux/2.6.6
      Tier: WebServer-Standard-1.0
      CNAME: UNKNOWN
      Updated: 2018-04-09 20:23:59.312000+00:00
    Printing Status:
    INFO: createEnvironment is starting.
    INFO: Using elasticbeanstalk-us-west-1-814752048877 as Amazon S3 storage bucket for environment data.
    INFO: Created security group named: sg-0f84dd5f7959f932f
    INFO: Created security group named: awseb-e-7iaptyh9gg-stack-AWSEBSecurityGroup-19AXML05AP8UG
    INFO: Created load balancer named: awseb-e-7-AWSEBLoa-5F4QOOSPZA9I
    INFO: Created Auto Scaling launch configuration named: awseb-e-7iaptyh9gg-stack-AWSEBAutoScalingLaunchConfiguration-1TSKD50BLQBZ7
    INFO: Created Auto Scaling group named: awseb-e-7iaptyh9gg-stack-AWSEBAutoScalingGroup-UN8HHDRN4V2J
    INFO: Waiting for EC2 instances to launch. This may take a few minutes.
    INFO: Created Auto Scaling group policy named: arn:aws:autoscaling:us-west-1:814752048877:scalingPolicy:f03d20db-305d-4eff-83bd-fa5532d682ea:autoScalingGroupName/awseb-e-7iaptyh9gg-stack-AWSEBAutoScalingGroup-UN8HHDRN4V2J:policyName/awseb-e-7iaptyh9gg-stack-AWSEBAutoScalingScaleUpPolicy-154NI4YA5Y480
    INFO: Created Auto Scaling group policy named: arn:aws:autoscaling:us-west-1:814752048877:scalingPolicy:f70e6de5-c82d-48f0-9324-db3fd69813a9:autoScalingGroupName/awseb-e-7iaptyh9gg-stack-AWSEBAutoScalingGroup-UN8HHDRN4V2J:policyName/awseb-e-7iaptyh9gg-stack-AWSEBAutoScalingScaleDownPolicy-MG1G34PEZK13
    INFO: Created CloudWatch alarm named: awseb-e-7iaptyh9gg-stack-AWSEBCloudwatchAlarmLow-ELWRG701RZXB
    INFO: Created CloudWatch alarm named: awseb-e-7iaptyh9gg-stack-AWSEBCloudwatchAlarmHigh-FRMTYE8GUX0W
    ****ERROR: Your WSGIPath refers to a file that does not exist.****
    

    这里的任何帮助将不胜感激。

0 个答案:

没有答案