Search code examples
pythongithubherokudeploymenttelegram-bot

Deploy Python Telegram Bot to Heroku


I Tried to deploy my python telegram bot on Heroku but when the Deploy end I Click to View it gives me Application Error. My Code is Running locally on PyCharm very well, I Prepare all the Requirements files to Deploy on Heroku(Requirement.txt & Procfile) and Uploaded them to GitHub.

This is my Code in GitHub: https://github.com/mohammad122333/python-telegram-bot

Another Question Can I Deploy my Code Without GitHub To keep my code Secure?

I'm new in stack overflow , Programming python and speaking English so Forgive me if there is a mistake..


Solution

  • You don't have a Procfile, see https://devcenter.heroku.com/articles/procfile

    It tells Heroku how your project is executed.

    Don't commit sensitive information such as tokens to git. Instead define them as environment variables. On the Heroku Dashboard you can use the environment variabl, see https://devcenter.heroku.com/articles/config-vars

    In Python you would retrieve the value of an environment variable via:

    import os
    TOKEN = os.environ["TOKEN"]
    

    You should always supply the entire log. It tells so much more information than just saying it does not work.