Python Project Start Command

Hi, I’m migrating from Heroku to Render. I use my private GitHub repository. My project is a Telegram bot written in Python. I use “python3 main.py” as the Start Command. The problem is, the deployment starts, the libraries are downloaded, but an error occurs in the deployment itself and I don’t understand which one, because it is not displayed. It happens that it writes “Starting with python3 main.py”, my bot starts working for a couple of minutes and stops working. At the same time, he writes that the deployment is unsuccessful. What to do and what is the problem?

Hi there,

Thanks for reaching out.

Your issue sounds similar to this post: Web App (Discord Bot) Deploy Keeps Failing?

I’m going to assume your bot on Heroku is using a “worker dyno” (not a “web dyno”). On Render, only Web Services (equivalent to a Heroku “web dyno”) are available on the free plan. Web Services expect (and check) the code is running a web server and is able to respond to HTTP web requests.

I’d expect you’d need a Background Worker (equivalent to a Heroku “worker dyno”) for the code you’re trying to run.

Alan

Alan

Thanks for the answer, but what should I add to my code?

I wouldn’t know what your code does, but if it’s just a bot and not a web server (e.g. using Gunicorn, etc.), you’ll need to deploy to Background Worker Service.

Alan

Thanks)

When i was having issues with this, i had to install gunicorn in order to deploy, but i kept getting the unsuccessful message because module app not found.

This was because my main file for running my app was called run.py, so i had to change my start command to gunicorn run:app

try changing run from my example to main and see if that work

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.