問題描述
我目前正在嘗試將我的 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 init
when inside your directory - (If you're using virtualenv or similar go into it and) do
pip freeze
then copy the contents you get to a file calledrequirements.txt
and 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.py
and save within the same repository
Make a text file called
runtime.txt
and pastepython-3.6.5
or 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 login
and input your heroku login detailsThen do
heroku apps:create name_of_app
andheroku buildpacks:set heroku/python
Finally, do
git push heroku main
orgit push heroku branch_name:main
if you want to only push one branch
這篇關于如何在 heroku 上托管我的 discord.py 機器人?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!