django cron tab does not runing every minutes

Hi,
in my project i want to use django-crontab

The work I have done

step 1
I executed the following command

pip install django-crotab

step 2
I added django_crontab to INSTALLED_APPS

step 3
I was built a text app
and I was added the following code to text/models.py

class Text(models.Model):
    text = models.CharField(max_length=500)

step 4
I was built cron.py in the text app
text/cron.py

def add_text():
    Text.objects.create(text='this is text')

step 4
I added the following code to the settings.py file

CRONJOBS = [
    ('*/1 * * * *', 'text.cron.add_text')
]

step 5
I with following command added crons

python manage.py crontab add

but when running deployment server, cron not working every minutes :frowning:

Did you run that add command on your deployment server?

Did you verify that you have a crontab command in /usr/bin?

The package does state that it does not work with Windows. If you’re trying to use it on Windows, it’s not going to work.

Also, your server configuration needs to allow for per-user cronfiles. (That may or may not be the default in your particular installation.)

You may also need to restart cron after the initial creation of a user-crontab file.

Finally, your server needs to be running cron and not an alternative scheduler. (Highly unlikely, but possible.)

my OS is linux manjaro
All configurations appear to be correct
And when I run the following command, cron works properly

python manage.py crontab run

My only problem is that the crons do not run every minute and I have to run them manually, which in this case only runs once, not every minute.

If you’ve verified that all your configurations are correct, then you realize that this is not a Django issue, right? It’s not Django that is supposed to be running these jobs.

I saw all the YouTube videos about cron in Django, but it didn’t help.
What do you think I should check?

This is not a Django issue. This has nothing to do with Django.

The only function performed by the django-crontab project is to create the user crontab file.

If everything is configured correctly, the end result of the add command is that a proper user-crontab file is created with the entries you’ve defined. Everything that happens after that is the responsibility of only cron. Django is not involved at that point.

You need to validate your cron configuration along with the content of your crontab file(s).

1 Like

Thanks You,
The problem was that the cron service was not running

how do you solve this getting same issue linux manjaro, django, corntab

This is an old topic that was solved. If you’re having a deployment issue with cron, please create a new topic for discussion, along the the appropriate details concerning your configuration and code implementation.