Reputation: 1
I need to deploy my Telegram bot on the Render hosting, but there is an error in the server logs:enter image description here
In this application I used Flask, Telebot and waitress to create a server.
To run the application, I use command "python main.py".
Here is my code:
import os
import telebot
import DBService
from telebot import types
from flask import Flask, request, jsonify
from flask_cors import CORS
import json
from waitress import serve
from threading import Thread
app = Flask(__name__)
CORS(app)
port = os.getenv('FLASK_PORT', '5000')
bot = telebot.TeleBot(TOKEN)
bot.set_webhook()
# some code
def run_flask():
port = int(os.getenv('PORT', 5000))
serve(app, host='0.0.0.0', port=port)
def run_bot():
bot.polling(non_stop=True)
if __name__ == '__main__':
# Parralel launch of Flask-app and Telegram bot
flask_thread = Thread(target=run_flask)
flask_thread.start()
bot_thread = Thread(target=run_bot)
bot_thread.start()
flask_thread.join()
bot_thread.join()
Could you tell what is wrong here?
I tried to use gunicorn instead of waitress, but nothing changed.
Upvotes: 0
Views: 49