zoukankan      html  css  js  c++  java
  • 创建应用程序源包AWS Elastic Beanstalk

    使用 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>
    ' % username
    
    # some bits of text for the page.
    header_text = '''
        <html>
    <head> <title>EB Flask Test</title> </head>
    <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>
    '''
    home_link = '<p><a href="/">Back</a></p>
    '
    footer_text = '</body>
    </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()
  • 相关阅读:
    元组,字典
    python字符串
    tensorflow 学习笔记
    tensorflow example1
    python第二章(2)列表
    python3.5学习第二章(1)标准库,bytes
    类加载过程
    数据值与地址值
    类的初始化与实例化顺序
    SpringCloudBus
  • 原文地址:https://www.cnblogs.com/cloudrivers/p/11620899.html
Copyright © 2011-2022 走看看