I have set up an admin command in django:
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
""" Command to parse logs that can be called from django """
def handle(self, *args, **options):
parse_logs()
I can call either from shell or python with call_command
. When I call it from the view this command stops all other requests to the app from working until it is finished.
I would like to be able to run this command in the background, maybe using a separate Thread, and displaying the results of the command on the webpage without having to reload the page. For example:
- Call command from webpage
- Continue doing other stuff in the webpage
- Once command is finished, display a notification on the webpage
- Never reload the webpage