簡體   English   中英

Python:在 heroku 上運行 Instapy

[英]Python: Running Instapy on heroku

我正在嘗試在 heroku 上創建一個 instagram 機器人。 我是新手,我不知道回溯的去向。 heroku logs --tail沒有多大幫助。

到目前為止我做了什么:

在終端上:

heroku buildpacks:add heroku/chromedriver master

heroku buildpacks:add heroku/google-chrome master

簡介:

web: gunicorn routes:app

路線.py:

from instapy import InstaPy
from instapy.util import smart_run
from flask import Flask


app = Flask(__name__)
# login credentials
insta_username = ''
insta_password = ''

# get an InstaPy session!
# set headless_browser=True to run InstaPy in the background
session = InstaPy(username=insta_username,
                password=insta_password,
                headless_browser=True,
                nogui=True)

@app.route('/')
def index():
    with smart_run(session):
        """ Activity flow """
        # settings
        session.set_relationship_bounds(
            enabled=True,
            delimit_by_numbers=True,
            max_followers=4590,
            min_followers=45,
            min_following=77)

        # actions
        session.like_by_tags(["natgeo"], amount=10)

    return 'Done'

我認為您想將 Procfile 更改為:

web: gunicorn app:app --log-file=-

用於記錄。 我的說 app:app 因為我的 py 文件被稱為 app,你的應該說:

web: gunicorn routes:app --log-file=-

另外,我更喜歡使用以下命令:

heroku logs -t -a <insert app name here>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM