Simple example of a python bot deployable on Heroku
Complete and simple example to host your python bot on Heroku.com
I highly recommend reading about the heroku cli to setup heroku for a successful deployment!
There are four required files in this repo for a successful deployment to heroku:
- 'bot.py': This is your python code
- 'Procfile': This calls the python file when you start your bot with 'heroku ps:scale worker=1'
- requirements.txt (can be empty)
- 'runtime.txt': specifies your python version
Contains all of your python code and is called when you start the bot
Calls bot.py when you start the bot. 'worker' is arbitrary but must be the same as specified in the Procfile
Start your bot with: heroku ps:scale worker=1
Lists all required packages to be downloaded by heroku on deployment. Here, you can list every module you import in the python file. Dont include out of the box modules like time or traceback! Leave empty if in doubt.
Specify the python version to be used.
1. Download the heroku cli
$ heroku login
$ git clone https://github.com/972C8/simple_heroku_bot.git
$ cd simple_heroku_bot
3. Push the cloned repo to heroku
$ heroku create
$ git push heroku master
$ heroku ps:scale worker=1 #start the bot
$ heroku logs --tail
$ heroku ps:scale worker=0 #stop the bot
Feel free to contribute to either the code example or the documentation.