# django-crontabs

**URL:** <https://forum.djangoproject.com/t/django-crontabs/31277>\
**Category:** Getting Started\
**Created:** [May 18, 2024, 1:49am UTC](https://forum.djangoproject.com/t/django-crontabs/31277 "2024-05-18T01:49:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anjanesh](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/anjanesh/32/4583_2.png) [@anjanesh](https://forum.djangoproject.com/u/anjanesh)\
**Post date:** [May 18, 2024, 1:49am UTC](https://forum.djangoproject.com/t/django-crontabs/31277/1 "2024-05-18T01:49:47Z")

</div>

How do I implement crons in my basic Django app ?  
I tried [django-crontabs](https://pypi.org/project/django-crontab/) but it doesn’t seem to run.

I did `python manage.py crontab add`  
I also tried running the cron command in the command line and it worked successfully.

So it’s the cron that’s not being executed ?

---

<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:** [May 18, 2024, 2:00am UTC](https://forum.djangoproject.com/t/django-crontabs/31277/2 "2024-05-18T02:00:42Z")

</div>

You don’t. You implement cron jobs at the operating system level like any other cron job. The “django-crontabs” app is fundamentally the wrong approach for a solution to this issue. (Also note that the last update to it is more than 6 years ago - I’d consider it pretty much a dead project.)

If you’re already using Celery within your project, [Celery Beat](https://docs.celeryq.dev/en/stable/reference/celery.beat.html#module-celery.beat) is another good solution.

---

<div class="post-metadata">

**Author:** ![anjanesh](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/anjanesh/32/4583_2.png) [@anjanesh](https://forum.djangoproject.com/u/anjanesh)\
**Post date:** [May 18, 2024, 2:19am UTC](https://forum.djangoproject.com/t/django-crontabs/31277/3 "2024-05-18T02:19:19Z")

</div>

I am not using Celery and I felt Celery would take some time to implement.  
So how do I run a script at say /djangoProject/app/crons/functionName which would include Django library ?

I included a name in urls.py as a path and [http://my-domain.example/cronPath](http://my-domain.example/cronPath) works but how do I execute it as a command in the terminal in a cron ?

---

<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:** [May 18, 2024, 2:22am UTC](https://forum.djangoproject.com/t/django-crontabs/31277/4 "2024-05-18T02:22:15Z")

</div>

> [@anjanesh](#):
>
> So how do I run a script at say /djangoProject/app/crons/functionName which would include Django library ?

You turn it into a custom Django management command. See [How to create custom django-admin commands | Django documentation | Django](https://docs.djangoproject.com/en/5.0/howto/custom-management-commands/).
