Reputation: 4353
I am following this document to schedule a cron job for my Django application. The following is the clock.py
:
from apscheduler.schedulers.blocking import BlockingScheduler
from django.shortcuts import redirect
sched = BlockingScheduler()
@sched.scheduled_job('interval', minutes=60)
def timed_job():
return redirect('http://example.com/')
sched.start()
Heroku shows the following error message:
django.core.exceptions.ImproperlyConfigured:
Requested setting ROOT_URLCONF, but settings are not configured. You
must either define the environment variable DJANGO_SETTINGS_MODULE or
call settings.configure() before accessing settings.
I have no idea about what the error message means. My questions:
clock.py
under the project root directory. Is it correct?Upvotes: 2
Views: 643
Reputation: 22311
The error message seems more like something related to how your project is structured, something outside of clock.py. Does some basic hello world view work when you open it in your browser? Do you have a settings.py file in place? Also check out the basic Django on Heroku tutorial and maybe try building from there to get the scheduling to work.
Upvotes: 1