新手-Heroku网站上的应用程序入门

时间:2019-02-27 06:20:53

标签: python heroku

我有一个应用程序,基本上可以“侦听” API调用(烧瓶)并根据输入内容运行脚本。

我现在很困惑我需要使用哪些模型? 一个工作人员应用和一个Web应用 B.一位网络工作者

由于价格和卧床情况,我要问这个问题。 该项目基本上只是等待POST请求24/7并执行python代码。

我是否需要将其分成此处所述的两个? https://medium.com/the-andela-way/how-to-build-a-task-notification-bot-for-slack-with-python-part-4-hosting-and-testing-cc2c727a67e6

或者将其保留为单个工作程序/ Web应用程序

打扰一下,丹尼尔,

我刚刚从Heroku网站重定向,所以我确定这个问题对专业人士来说很容易。

我正在按照之前发送的LINK工作。

他在步骤3中解释:

  

在项目文件夹的根目录中添加一个名为Procfile的文件。我们将在文件中添加>以下片段。 heroku将使用它来启动在Web服务器(gunicorn)上运行的应用程序,以及在heroku> worker上运行的webhook。   网站:gunicorn ranti:应用   worker:python worker.py

我的代码如下:

from config import get_env
from app import create_app


app = create_app(get_env('APP_ENV'))

if __name__ == '__main__':
    app.run()

路线如下:

    def index():
        return "WORKING"

    @app.route('/todo', methods=['POST'])
    def abc():
        print(request.json)
        email = request.json['email']
        ticket_id = request.json['ticket_id']
        message1 = Psycopg2Helper.sql_query1(email, sql_user, sql_password, sql_db, sql_host_eu)
        if not message1:
            message1 = Psycopg2Helper.sql_query1(email, sql_user, sql_password, sql_db, sql_host_us)
        if not message1:
            message1 = Psycopg2Helper.sql_query1(email, sql_user, sql_password, sql_db, sql_host_ap)
        text_to_zd = ZenDesk.edit(message1)
        ZenDesk.put_comment(ticket_id, text_to_zd, zd_user, zd_password)
        return email

classs文件仅通过API对不同的站点进行注释。 (PUT命令)

所以,我的问题是,我需要将我的应用分为两部分吗?一个WEB和一个WORKER作为链接说明,或者我将仅使用一个WEB文件(我的情况:main_app.py:)

0 个答案:

没有答案
相关问题