F
F
FatherofNations2017-08-27 13:10:25
Multithreading
FatherofNations, 2017-08-27 13:10:25

How can Threads be implemented in Python Flask?

The task is to write a small function that will interact with the database, but when called, it must perform the same actions only after a certain time (time.sleep). So that the rest of the code does not stop its execution, there are ideas with implementation through Thread. Python3.5 Flask Framework

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
chupasaurus, 2017-08-27
@chupasaurus

threading .

P
Pavel, 2017-08-28
@toobinks

As has been suggested many times here. You can look at Celery.
Periodic Tasks
docs.celeryproject.org/en/latest/userguide/periodi...
app.conf.beat_schedule = {
'add-every-30-seconds': {
'task': 'tasks.add',
'schedule': 30.0,
'args': (16, 16)
},
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question