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
No description
11 Replies
Percy
Percy13mo ago
Project ID: a416e671-d36f-42c8-9ace-dbc87e9644d6
evanhitchen
evanhitchenOP13mo ago
project ID: a416e671-d36f-42c8-9ace-dbc87e9644d6
Adam
Adam13mo ago
what step is the service failing at? Please provide logs
evanhitchen
evanhitchenOP13mo ago
Thats the thing, its not even getting to that
No description
No description
evanhitchen
evanhitchenOP13mo ago
just fails instantly Going to make a fresh one in case
evanhitchen
evanhitchenOP13mo ago
No description
No description
Adam
Adam13mo ago
huh that’s really odd can you send the source code? I’ll play around with it
evanhitchen
evanhitchenOP13mo ago
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
Adam
Adam13mo ago
that’s very odd… What happens if you just start the service as a regular service rather than a cron job?
evanhitchen
evanhitchenOP13mo ago
ok so a normal 'service' works which is good at least
Adam
Adam13mo ago
Can you send your repo? I have a suspicion as to what the issue is but i’d like to make sure first
Want results from more Discord servers?
Add your server