Python CGI queue

前端 未结 1 1273
离开以前
离开以前 2021-01-25 21:03

I\'m working on a fairly simple CGI with Python. I\'m about to put it into Django, etc. The overall setup is pretty standard server side (i.e. computation is done on th

相关标签:
1条回答
  • 2021-01-25 21:46

    Definitely use celery. You can run an amqp server or I think you can sue the database as a queue for the messages. It allows you to run tasks in the background and it can use multiple worker machines to do the processing if you want. It can also do cron jobs that are database based if you use django-celery

    It's as simple as this to run a task in the background:

    @task
    def add(x, y):
        return x + y
    

    In a project I have it's distributing the work over 4 machines and it works great.

    0 讨论(0)
提交回复
热议问题