How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 机器人?)
问题描述
我目前正在尝试将我的 discord 机器人安装到 Heroku 并 24/7 全天候托管它,但我遇到了问题.
我将我的机器人上传到了 github ,用记事本打开它并写入
worker: python name_of_bot_file.py并保存在同一个存储库中
创建一个名为
runtime.txt的文本文件并粘贴python-3.6.5或您用于编写机器人的任何 python 版本并将其保存在相同的存储库.(如果您在 virtualenv 中,请退出)打开控制台并编写
heroku login并输入您的 heroku 登录详细信息然后执行
heroku apps:create name_of_app和heroku buildpacks:set heroku/python最后,如果你只想推送一个分支,请执行
git push heroku main或git push heroku branch_name:main
I am currently trying to get my discord bot on to Heroku and host it 24/7 but I am having problems.
I uploaded my bot to github https://github.com/zemocode/flankebot/tree/master
I have created the two main files I needed
I clicked deploy branch on Heroku and I'm getting this error.
! No default language could be detected for this app.
HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
See https://devcenter.heroku.com/articles/buildpacks
! Push failed
I have followed tutorials but everyone else has node.js and I so mine doesn't work.
You're missing a couple of things to make this work, for the sake of everyone Googling how to host discord.py on Heroku and getting this as the top result here's a step-by-step
- Install Git and do
git initwhen inside your directory - (If you're using virtualenv or similar go into it and) do
pip freezethen copy the contents you get to a file calledrequirements.txtand save it in the same repository as the bot - Make a file (a file of type file)
, open it with notepad and write
worker: python name_of_bot_file.pyand save within the same repository
Make a text file called
runtime.txtand pastepython-3.6.5or whichever python version you were using to write the bot and save it in the same repository.(If you're inside virtualenv get out and) open your console and write
heroku loginand input your heroku login detailsThen do
heroku apps:create name_of_appandheroku buildpacks:set heroku/pythonFinally, do
git push heroku mainorgit push heroku branch_name:mainif you want to only push one branch
这篇关于如何在 heroku 上托管我的 discord.py 机器人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 heroku 上托管我的 discord.py 机器人?
基础教程推荐
- Python,确定字符串是否应转换为 Int 或 Float 2022-01-01
- Kivy 使用 opencv.调整图像大小 2022-01-01
- 比较两个文本文件以找出差异并将它们输出到新的文本文件 2022-01-01
- 对多索引数据帧的列进行排序 2022-01-01
- matplotlib 设置 yaxis 标签大小 2022-01-01
- 在 Django Admin 中使用内联 OneToOneField 2022-01-01
- 究竟什么是“容器"?在蟒蛇?(以及所有的 python 容器类型是什么?) 2022-01-01
- Python 中是否有任何支持将长字符串转储为块文字或折叠块的 yaml 库? 2022-01-01
- 在 Python 中将货币解析为数字 2022-01-01
- kivy 应用程序中的一个简单网页作为小部件 2022-01-01
