在AWS Elastic Beanstalk中部署Flask App [英] Deploying Flask App in AWS Elastic Beanstalk

查看:123
本文介绍了在AWS Elastic Beanstalk中部署Flask App的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

部署烧瓶应用程序时,它说成功,但是当我检索日志时,看到错误找不到烧瓶".我的需求文件中有烧瓶.任何帮助.

when I deploy my flask app, it says successful but when I retrieve the logs, I see the error "Flask not found". I have flask in my requirements file. Any help.

[Sat Jan 11 06:51:50.503908 2020] [:错误] [pid 3393] [远程127.0.0.1:0] mod_wsgi(pid = 3393):目标WSGI脚本'/opt/python/current/app/application.py'无法作为Python模块加载.

[Sat Jan 11 06:51:50.503908 2020] [:error] [pid 3393] [remote 127.0.0.1:0] mod_wsgi (pid=3393): Target WSGI script '/opt/python/current/app/application.py' cannot be loaded as Python module.

[Sat Jan 11 06:51:50.503953 2020] [:错误] [pid 3393] [远程127.0.0.1:0] mod_wsgi(pid = 3393):处理WSGI脚本'/opt/python/current/时发生异常app/application.py".

[Sat Jan 11 06:51:50.503953 2020] [:error] [pid 3393] [remote 127.0.0.1:0] mod_wsgi (pid=3393): Exception occurred processing WSGI script '/opt/python/current/app/application.py'.

[Sat Jan 11 06:51:50.504123 2020] [:error] [pid 3393] [remote 127.0.0.1:0] Traceback(最近一次通话最近):[Sat Jan 11 06:51:50.504151 2020] [ :error] [pid 3393] [remote 127.0.0.1:0]文件"/opt/python/current/app/application.py",第1行,在 [Sat Jan 11 06:51:50.504156 2020] [:error] [pid 3393] [远程127.0.0.1:0]来自烧瓶导入烧瓶

[Sat Jan 11 06:51:50.504123 2020] [:error] [pid 3393] [remote 127.0.0.1:0] Traceback (most recent call last): [Sat Jan 11 06:51:50.504151 2020] [:error] [pid 3393] [remote 127.0.0.1:0] File "/opt/python/current/app/application.py", line 1, in [Sat Jan 11 06:51:50.504156 2020] [:error] [pid 3393] [remote 127.0.0.1:0] from flask import Flask

[Sat Jan 11 06:51:50.504170 2020] [:error] [pid 3393] [remote 127.0.0.1:0] ModuleNotFoundError:没有名为"flask"的模块.

[Sat Jan 11 06:51:50.504170 2020] [:error] [pid 3393] [remote 127.0.0.1:0] ModuleNotFoundError: No module named 'flask'.

下面是我的application.py内容

Below is my application.py content

from flask import Flask
from myapp import create_app

application = create_app()

if __name__ == "__main__":
    application.run()

以下是我的要求内容.txt

Below is the content of my requirements.txt

Click==7.0
-e git+https://github.com/xxxxxx/xxx.git@xxxx#egg=xxx
Flask==1.1.1
itsdangerous==1.1.0
Jinja2==2.10.3
MarkupSafe==1.1.1
numpy==1.18.1
PyYAML==3.13
scipy==1.4.1
Werkzeug==0.16.0

推荐答案

您应该在文件夹的根目录下具有application.pyrequirements.txt.部署的zip文件还应在zip文件的根目录中包含这两个文件.我已经附加了参考资料,显示了如何下载已部署的应用程序捆绑包.

You should have application.py and the requirements.txt at the root of the folder. Your deployed zip file also should contain these two files at the root of the zip file. I have attached the reference shows how to download a deployed application bundle.

参考: 从AWS Elastic Beanstalk下载应用程序

希望这会有所帮助.

这篇关于在AWS Elastic Beanstalk中部署Flask App的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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