question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: no such table: django_apscheduler_djangojob

See original GitHub issue

In a project that has used django_apscheduler, executing python manage.py migrate will report this error:

django.db.utils.OperationalError:  no such table: django_apscheduler_djangojob

The reason is because the code already references the timing task of django_apscheduler, how can I solve this? thanks~

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
iHTCboycommented, Sep 11, 2020

@jcass77

I know why:

scheduler = BackgroundScheduler()
scheduler.add_jobstore(DjangoJobStore(), 'default')

@register_job(scheduler, 'cron', hour=8, minute=30, replace_existing=True)
def delete_tmp_files():
    pass

scheduler.start()

remove that : scheduler.start() , run python manage.py migrate is ok, so way?

I try to:

scheduler = BackgroundScheduler()
scheduler.add_jobstore(DjangoJobStore(), 'default')

@register_job(scheduler, 'cron', hour=8, minute=30, replace_existing=True)
def delete_tmp_files():
    pass


try:
    scheduler.start()
except KeyboardInterrupt:
    scheduler.shutdown()
    print("Scheduler shut down successfully!")

Still no good, so way error? thanks~

0reactions
dennohpetercommented, May 11, 2021

Ensure you have ⬇️ ⬇️ ⬇️ ⬇️ on your settings.py

import dj_database_url
...

db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
Read more comments on GitHub >

github_iconTop Results From Across the Web

python - "no such table" exception - Stack Overflow
To fix this error just change "django.contrib.admin" in INSTALLED_APPS to "django.contrib.admin.apps.SimpleAdminConfig" , it will prevent " ...
Read more >
error - no such table - Using Django
I'm trying to make an e-mail authorization and get an error when creating superuser. What's wrong? application 'www' models.py from ...
Read more >
django-apscheduler - PyPI
This is a Django app that adds a lightweight wrapper around APScheduler. It enables storing persistent jobs in the database using Django's ORM....
Read more >
django_apscheduler.models.DjangoJobExecution ... - GitHub
Looking at the job executions table it looks like some of them end up in the 'started executing' state and are never marked...
Read more >
python manage.py test: django.db.utils.OperationalError: no ...
utils.OperationalError: no such table: accounts_user . I have the User model within the accounts app and the accounts app has been added to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found