# Is there a time limit for processes? Best to start processes in background?

**URL:** <https://forum.djangoproject.com/t/is-there-a-time-limit-for-processes-best-to-start-processes-in-background/43636>\
**Category:** Getting Started\
**Created:** [December 5, 2025, 4:37pm UTC](https://forum.djangoproject.com/t/is-there-a-time-limit-for-processes-best-to-start-processes-in-background/43636 "2025-12-05T16:37:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cseberino](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/cseberino/32/5026_2.png) [@cseberino](https://forum.djangoproject.com/u/cseberino)\
**Post date:** [December 5, 2025, 4:37pm UTC](https://forum.djangoproject.com/t/is-there-a-time-limit-for-processes-best-to-start-processes-in-background/43636/1 "2025-12-05T16:37:43Z")

</div>

Sometimes my Django web apps will need to execute a short script with

subprocess.call([…]). I believe there are issues if it take more than a few seconds?

If I want to execute several of these, should I run them in the background?

Are there any issues with spawning about 10 - 20 subprocess.call’s that each

take 10-ish sec?

cs

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [December 5, 2025, 5:04pm UTC](https://forum.djangoproject.com/t/is-there-a-time-limit-for-processes-best-to-start-processes-in-background/43636/2 "2025-12-05T17:04:11Z")

</div>

> [@cseberino](#):
>
> will need to execute a short script with  
> subprocess.call([…]).

Short answer - Do **not** do this if there’s _any_ chance _at all_ that the subprocess _might_ need to continue past the point that the view returns the response. Use Celery or one of the similar background-processing task managers.

Note that even [Django’s Tasks framework](https://docs.djangoproject.com/en/6.0/topics/tasks/#django-s-tasks-framework) works under the principle of disconnecting the view from those tasks:

> The actual execution must be handled by infrastructure outside Django, such as a separate process or service.

For more on this, see:

- [Django can't start multiple Threads](https://forum.djangoproject.com/t/django-cant-start-multiple-threads/26294)
- [How does Django support asynchronous operations](https://forum.djangoproject.com/t/how-does-django-support-asynchronous-operations/42201)

(There are a number of other topics here discussing this. Searching the forum for “background tasks” or “background processes” will give you a number of them.)

---

<div class="post-metadata">

**Author:** ![cseberino](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/cseberino/32/5026_2.png) [@cseberino](https://forum.djangoproject.com/u/cseberino)\
**Post date:** [December 17, 2025, 5:05pm UTC](https://forum.djangoproject.com/t/is-there-a-time-limit-for-processes-best-to-start-processes-in-background/43636/3 "2025-12-17T17:05:33Z")

</div>

Celery is for enterprise level scaling for heavy traffic websites. If someone is not there yet, is it

ok to just create threads for long running functions like below?

```auto
import threading

t = threading.Thread(target=long_running_function,
                            args=args,
                            kwargs=kwargs)
t.setDaemon(True)
t.start()

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [December 17, 2025, 5:18pm UTC](https://forum.djangoproject.com/t/is-there-a-time-limit-for-processes-best-to-start-processes-in-background/43636/4 "2025-12-17T17:18:40Z")

</div>

> [@cseberino](#):
>
> Celery is for enterprise level scaling for heavy traffic websites.

But not _only_ for those sites. It’s also quite suitable for small sites. (I use it regularly.)

> [@cseberino](#):
>
> If someone is not there yet, is it
> 
> ok to just create threads for long running functions like below?

No.

See the previous reply.

---

<div class="post-metadata">

**Author:** ![cseberino](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/cseberino/32/5026_2.png) [@cseberino](https://forum.djangoproject.com/u/cseberino)\
**Post date:** [December 30, 2025, 8:10pm UTC](https://forum.djangoproject.com/t/is-there-a-time-limit-for-processes-best-to-start-processes-in-background/43636/6 "2025-12-30T20:10:49Z")

</div>

Ken

You were so right! I finally tried Celery and it is quite nice and easy to set up!

Thanks for the help!

Chris

---

<div class="post-metadata">

**Author:** ![kamalaSura](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kamalasura/32/31113_2.png) [@kamalaSura](https://forum.djangoproject.com/u/kamalaSura)\
**Post date:** [January 10, 2026, 4:09am UTC](https://forum.djangoproject.com/t/is-there-a-time-limit-for-processes-best-to-start-processes-in-background/43636/7 "2026-01-10T04:09:44Z")

</div>

Running several subprocesses.call() can be risky, as it can lead to timeouts or slow responses, so moving long subprocess calls to the background is the right call.
