/heroku-python-script

:ng: Example of how to host your script (bot ot something like that) on heroku.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Template for Python Script hosted on Heroku

This is small example of running your own bots with Heroku. You can run ANY python script with ANY dependaries.

Getting Started

  1. Download this repository.

  2. Register on Heroku.

  3. Download and install Heroku CLI.

  4. Download and install git.

  5. Copy your script/ project to repository's folder.

  6. Replace "script.py" with path to your main executable file in "Procfile".

    worker: python script.py
    
  7. You may select your python version and runtime with "runtime.txt". Read how on official heroku page.

  8. If you are using non-standart modules, you must add them to requirements.txt

    To check which version of module you have on your computer, run pip freeze | grep MODULE_NAME in the terminal.

    You will get line MODULE_NAME==MODULE_VERSION. Add this line to "requirements.txt".

    You should remove any unused modules from "requirements.txt".

    Repeat this process for all the modules you are planning to use.

  9. Now open terminal(or do it other way, but i will explain how to do it in terminal on Ubuntu) and create git repository.

git init

Create heroku app.

heroku create

And push your code into heroku app.

git add .
git commit -m "initial commit"
git push heroku master
  1. Run you worker with following command.
heroku ps:scale worker=1
  1. Now everything should be working. You can check your logs with.
heroku logs --tail
  1. From now on you can use usual git commands(push, add, commit etc.) to update your app.

Everytime you push heroku master your app gets redeployed.

Prerequisites

Authors

License

This project is licensed under GNU General Public License v3.0 - see the LICENCE.md file for details

Acknowledgments