如何在Heroku上为Discord bot托管安装discord.py-rewrite依赖项?

问题描述:

我正在尝试使用我的GitHub master分支在Heroku上部署discord.py机器人,但由于git错误而无法执行:假设提交,找不到标签或分支重写".要成功安装重写"依赖项,我需要做些什么?

I'm trying to deploy my discord.py bot on Heroku using my GitHub master branch, but have been unable to do because of a git error: Could not find a tag or branch 'rewrite', assuming commit. What do I need to do to successfully install the 'rewrite' dependency?

我当前正在使用文件"requirements.txt","runtime.txt","Procfile"和"Aptfile".我已经在我的requirements.txt文件中尝试了几种依赖关系组合,包括:

I am currently using the files "requirements.txt", "runtime.txt", "Procfile" and "Aptfile". I've tried several combinations of dependencies in my requirements.txt file, including:

这些是Heroku所需的文件内容:

These are the contents of my files needed for Heroku:

requirements.txt: git + https://github.com/Rapptz/discord.py@rewrite

requirements.txt: git+https://github.com/Rapptz/discord.py@rewrite

runtime.txt: python-3.6.8

runtime.txt: python-3.6.8

Procfile: worker:python bot.py

Procfile: worker: python bot.py

Aptfile: git

在使用 git + https://github.com/Rapptz/discord.py@rewrite 进行尝试以部署机器人时, heroku日志--tail 将显示错误:

When using anything but git+https://github.com/Rapptz/discord.py@rewrite in attempts to get the bot deployed, heroku logs --tail will display the error:

self.custom_red = discord.Colour.from_rgb(255, 0, 0)  # ff0000
AttributeError: type object 'Colour' has no attribute 'from_rgb' 

我要强调的重要一点是,即使已经测试了代码的那部分,PyCharm也不会在本地抛出此错误.这就是我得出的结论,即我在Heroku上安装重写"依赖项时遇到问题.

The important thing I want to emphasize is that PyCharm does not throw this error locally, even having tested that part of the code. This is how I came to the conclusion that that I am having issues with installing the 'rewrite' dependency on Heroku.

这是Heroku上的完整错误日志:

This here is the full error log on Heroku:

-----> Uninstalling stale dependencies
       Uninstalling discord.py-0.16.12:
         Successfully uninstalled discord.py-0.16.12
-----> Installing requirements with pip
       Collecting git+https://github.com/Rapptz/discord.py@rewrite (from -r /tmp/build_9642c6bfbfd8e0f0ea526230740f0bd1/requirements.txt (line 1))
         Cloning https://github.com/Rapptz/discord.py (to rewrite) to /tmp/pip-41cdp1qz-build
         Could not find a tag or branch 'rewrite', assuming commit.
       error: pathspec 'rewrite' did not match any file(s) known to git.
       Command "git checkout -q rewrite" failed with error code 1 in /tmp/pip-41cdp1qz-build
 !     Push rejected, failed to compile Python app.
 !     Push failed 

话虽这么说,有什么建议可以通过成功安装重写"依赖项来帮助我克服此错误,从而使我的机器人在Heroku上正常工作吗?

That being said, are there any suggestions to help me get past this error by successfully installing the "rewrite" dependency and thus, have my bot functional on Heroku?

请告知我是否可以提供其他信息.非常感谢您的帮助.

Please let me know if I can provide any additional information. Any help is much appreciated.

重写分支已合并,并且不再存在.使用可从PyPI获得,这是最新的.

The rewrite branch has been merged, and no longer exists. Use the version of discord.py available from PyPI, that's currently the latest.