Some functions should run asynchronously on the web server. Sending emails or data post-processing are typical use cases.
What is the best (or most pythonic) way write a decorator function to run a function asynchronously?
My setup is a common one: Python, Django, Gunicorn or Waitress, AWS EC2 standard Linux
For example, here's a start:
from threading import Thread
def postpone(function):
    def decorator(*args, **kwargs):
        t = Thread(target = function, args=args, kwargs=kwargs)
        t.daemon = True
        t.start()
    return decorator
desired usage:
@postpone
def foo():
    pass #do stuff
 
     
    