-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Django cronjob error while using database #118
Comments
Has anyone been able to fix this? The package seems unmaintained. |
Hi tngeene, I changed crontab and use a basic django/celery configuration to execute asynchronous tasks in the background. Regards, |
Thanks. It's quite unprofessional to make a package that doesn't work, even more, unprofessional not to reply to issues. |
This is old, but I had the same issue today and ended up here. In my case, the difference between running manually and running with the cronjob is the access to the env variables. By default, crontab doesn't have access to any env variables, so they have to be added manually with CRONTAB_COMMAND_PREFIX. For example, in my settings, if I didn't set DJANGO_ENV = production it would create a SQLite db and would not access my prod database. Because of that, I had the error, no such table. To fix the issue I had to pass all necessary env variables to the cronjob to be able to connect to the correct database. for example:
Hope this helps someone :D |
Environment & Versions
Settings
django-crontab
settings:Details
crontab -l
after runningpython manage.py crontab add
.crontab run
command and I copy this command to my terminal the job works: yesWhen I run the
docker-compose exec web python manage.py crontab run 569660dc453e6ba975461f0d2f5f25dc
manually it works perfectly and the cronjob downloads data from a web application and stores the data on a Postgres database. But when cron executes the job it returns the following error "no such table: news_app_blog".Searching for the same error I only found one entry in stackoverflow that doesn't have any reply and its the same error that I have.
Regards,
The text was updated successfully, but these errors were encountered: