How should I trigger async functions during django/flask views?
In node.js, I can easily bypass an async function, like so:
module.exports.myView = function (request, response) {
myVerySlowFunction(function (nonsense) {
console.log('handle triggered nonsense', nonsense);
});
response.json({ message: 'ok' });
}
This is very typical to do in node, but I've never seen it done in django. I'm wanting to translate it like so:
def my_view(request):
apply_async(my_very_slow_function)
return Response({'message': 'okay'})
I have used Celery in the past for this, but it feels like overkill to have a separate server running just so I can trigger async functions.
I know I can trigger async functions like so: https://stackoverflow.com/a/1239252/4637643, but have never seen them in the context of a web application.
Is this a bad idea? should I look for another solution?