2

I deployed a Django app using free version of Heroku. Now I need to run some background task so I choose django-background-tasks . As per the documentation, I have to run python manage.py process_tasks command after running the project using python manage.py runserver . So I added Procfile as below

worker: python manage.py process_tasks
web: gunicorn CYC_Heroku.wsgi

But, I couldn't scale the app cause, I'm using a free version. then, can I do the same without paying money / without credit card ??

  • Possible duplicate of [Running Heroku background tasks with only 1 web dyno and 0 worker dynos](http://stackoverflow.com/questions/12634447/running-heroku-background-tasks-with-only-1-web-dyno-and-0-worker-dynos) – Grisha Levit Jan 28 '17 at 07:33

2 Answers2

2

Heroku Scheduler will allow you to run background tasks for free at one of the following frequencies: every 10 minutes, every hour, or every day. It will use the same dyno type that you use for your web dyno, so if you're using a free dyno to run your app, it will also use a free dyno to run your scheduled tasks.

Once you add it to your app, open it from your Heroku app's Resources view. Add a new job and enter python manage.py process_tasks as the command, and select your desired frequency.

Hopefully you can make this work for your use case!

Michael Godshall
  • 880
  • 11
  • 18
  • 1
    It's says __Please verify your account to install this add-on plan (please enter a credit card) For more information, see https://devcenter.heroku.com/categories/billing Verify now at https://heroku.com/verify__
    –  Jan 29 '17 at 03:49
  • Looks like you will need to add a credit card, but you can still use the app for free as I explained above. – Michael Godshall Jan 30 '17 at 17:23
  • I found that **Heroku Scheduler** is free but, we have to add Credit card to use the app. So any other alternative solution is there ? –  Jan 31 '17 at 15:29
  • I'm not aware of any other free alternative that will automatically run background tasks for you. The only other free option is to manually run the commands in your command prompt using `heroku run python manage.py process_tasks`. You will not need a credit card to do this. – Michael Godshall Jan 31 '17 at 19:07
1

Actually, you can set up a clock process in heroku using APScheduler now.

I just tried it and it works great.

You can set up the time as you like, 1 minute is also allowed.

And it's free.

mhchia
  • 139
  • 1
  • 8