码迷,mamicode.com
首页 > 其他好文 > 详细

创建应用程序源包AWS Elastic Beanstalk

时间:2019-10-03 23:50:59      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:文件组   line   link   tor   app   目录   run   aws   return   

使用 AWS Elastic Beanstalk 控制台部署新应用程序或应用程序版本时,需要上传源包。源包必须符合以下要求:

  • 由单个 ZIP 文件或 WAR 文件组成 (您可以在 WAR 文件中包含多个 ZIP 文件)

  • 不超过 512 MB

  • 不包含父文件夹或顶级目录 (可包含子目录)

如果您要部署处理定期后台任务的工作线程应用程序,您的应用程序源包还必须包括一个 cron.yaml 文件。

~/myapp$ zip ../myapp.zip -r * .[^.]*
  adding: app.js (deflated 63%)
  adding: index.js (deflated 44%)
  adding: manual.js (deflated 64%)
  adding: package.json (deflated 40%)
  adding: restify.js (deflated 85%)
  adding: .ebextensions/ (stored 0%)
  adding: .ebextensions/xray.config (stored 0%)
from flask import Flask

# print a nice greeting.
def say_hello(username = "World"):
    return <p>Hello %s!</p>\n % username

# some bits of text for the page.
header_text = ‘‘‘
    <html>\n<head> <title>EB Flask Test</title> </head>\n<body>‘‘‘
instructions = ‘‘‘
    <p><em>Hint</em>: This is a RESTful web service! Append a username
    to the URL (for example: <code>/Thelonious</code>) to say hello to
    someone specific.</p>\n‘‘‘
home_link = <p><a href="/">Back</a></p>\n
footer_text = </body>\n</html>

# EB looks for an ‘application‘ callable by default.
application = Flask(__name__)

# add a rule for the index page.
application.add_url_rule(/, index, (lambda: header_text +
    say_hello() + instructions + footer_text))

# add a rule when the page is accessed with a name appended to the site
# URL.
application.add_url_rule(/<username>, hello, (lambda username:
    header_text + say_hello(username) + home_link + footer_text))

# run the app.
if __name__ == "__main__":
    # Setting debug to True enables debug output. This line should be
    # removed before deploying a production app.
    application.debug = True
    application.run()

 

创建应用程序源包AWS Elastic Beanstalk

标签:文件组   line   link   tor   app   目录   run   aws   return   

原文地址:https://www.cnblogs.com/cloudrivers/p/11620899.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!