T
T
Ternick2021-06-17 19:04:29
Python
Ternick, 2021-06-17 19:04:29

How to enable threads in pythonanywhere?

I use Flaks server to accept hooks from Telegram. In the telegram bot itself, you need to create a new thread. To delete a message after a while.

TeleBot itself didn't work either until I set threaded = False.
bot = TeleBot(config["api_key"], threaded = False)

How can the issue be resolved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2021-06-17
@Ternick

pythonanywhere does not support threading.

FAQ
Can I use celery? -- at the moment the answer is no. We're working on it.
Can I just use threads? -- we don't support threads in web apps, no

The only option is to use asynchronous code.
As an alternative - run a separate service that will pick up tasks for deletion from the database

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question