Django Cron Job
Hello all, I am trying to write a cron job for my django project but I cannot for the life of me get it to work. The steps I have followed:
- I have created a cron service like the photo attached.
- Have set that up and the command I am trying to run is: python manage.py commandtest
I have also tried running something like this: railway run --service {{SERVICE_ID}} python manage.py my_command
But no luck, any help would be hugely appreciated with this
11 Replies
Project ID:
a416e671-d36f-42c8-9ace-dbc87e9644d6
project ID: a416e671-d36f-42c8-9ace-dbc87e9644d6
what step is the service failing at? Please provide logs
Thats the thing, its not even getting to that
just fails instantly
Going to make a fresh one in case
huh that’s really odd
can you send the source code? I’ll play around with it
What do you mean? As in the django command?
from django.core.management.base import BaseCommand
import logging
logger = logging.getLogger(name)
class Command(BaseCommand):
help = "Test on railway"
def handle(self, *args, **kwargs):
self.stdout.write('test std out')
logger.warning('warning test')
logger.error('error test')
I took it back to basics as I was fed up
Its definitely the command as if I remove that it runs, but why that command i dont know
that’s very odd… What happens if you just start the service as a regular service rather than a cron job?
ok so a normal 'service' works which is good at least
Can you send your repo?
I have a suspicion as to what the issue is but i’d like to make sure first