Thursday, January 8, 2015

Re: How to run background application via Django

Look into celery. It's the best and easiest way to run bg jobs imo

On 08/01/2015 9:10 pm, "Sugita Shinsuke" <shinriyo@gmail.com> wrote:
Hi there.

I'd like to run background application.

I coded this code.

I wrote the urls.py and I added in the view.

def run_junix(request):
    cmd = "cd app_path;nohup python background_app.py &"
    import subprocess
    proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

    return HttpResponse("bg test")

Is it good way? or using supervisor or, if you know the better way, would you tell me?

Anyone who know this matter, please help.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0a8222ff-a22c-44a5-a098-2b663aaca294%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHqTbjnHWho4t5KAV9cf0fbKvckGpTCBFycKnxWdR7SAK2W9OA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment