DEV Community

Discussion on: Scheduling tasks using APScheduler in Django

Collapse
 
zsmain profile image
Ismail Zouaoui

Short, precise and works perfectly,
The only problem is that the scheduler runs the function "update_something()" two times at a specific time.

Collapse
 
prabinsr profile image
Prabin

python manage.py runserver --noreload solved this issue.

Collapse
 
thelostkite profile image
the-lost-kite

It's because of development and deployment.
Add this condition before running your scheduler.
if os.environ.get('RUN_MAIN'):