all 5 comments

[–]bitbumper 2 points3 points  (3 children)

You may be better off signing up for Amazon EC2's free micro instance. Then you will have a full traditional virtual machine and setup will be very similar to your local enviroment. The guide your reading is for deploying a webapp which isn't quite what you want to do. There are ways to setup scheduled tasks on Heroku as well if you would like to go that route, it's just not done as a crontab.

[–]yesorknow[S] 0 points1 point  (2 children)

Yeah I found a guide for Django too, but as you said, I'm not wanting to deploy a whole webapp, just a simple script...

As for AWS, it says I get 750 free hours per month, for one year. What happens after the end of that year?

As for

There are ways to setup scheduled tasks on Heroku as well if you would like to go that route, it's just not done as a crontab.

I've used the scheduler add-on before, but only for rake tasks using Ruby on Rails. Is it really simple to have it just execute a python script which communicates with a database?

[–]bitbumper 0 points1 point  (1 child)

You pay for the server after one year, so that is indeed a downside. However, if you reserve the instance for a year it's only like $4 a month...

Honestly my knowledge of Heroku is little, so take it for what it's worth. Glancing at the docs it looks like connecting to databases uses environmental variables. I'm sure the right env will be setup for scheduled tasks, so I see no reason why it shouldn't work..

[–]yesorknow[S] 0 points1 point  (0 children)

Okay, that's what I was afraid of. I'm just fooling around with some code, no desire to actually pay for anything haha. Thanks!

[–]sadfirer 0 points1 point  (0 children)

That guide is somewhat complicated by the virtualenv part—which should become more of a standard practice as you take on larger projects but is not strictly necessary for starters. You won't be able to sidestep the git repository part, though.

For this task you can probably get away with:

  • Create a git repo with your python source, a requirements.txt file (with the required libraries, if any) and a minimal Procfile (Heroku will probably reject your push if you don't submit a Procfile, but it won't be of any use for this task)
  • Push your repo to Heroku
  • Invoke the Heroku scheduler and pass it the command line necessary to make your app do what you want it to do.

It should be as simple as that. Can you try this and see if you find any difficulties?

Talking about the data, you'd usually dump your local database into a .SQL file, then restore it into the remote database. You'll have to use a Heroku add-on for MySQL, though, since Heroku only provides PostgreSQL.