Still fine, just keep going! Oh, wait. If you’re pretty new to Git, you’re usually typing “git push origin master” to push things, right? That is actually “git push <remote> master”, which in this context, it means Heroku’s git.

Well, what is actually this Procfile thing? Well, it’s actually some kind of “environment settings”. You’ll use it if you want to develop locally. The normal Procfile is the Procfile used by Heroku, while Procfile.windows is used to develop locally in Windows environment.

Install venv. After that, you’ll notice a folder called “venv” in your local app folder. Activate it. Then try to run with “foreman start web -f Procfile.windows”. Now this is where all my problem starts! You will notice that you couldn’t connect to “localhost:5000”. Try to break the batch process, then you will see some error like this:

Well, you actually don’t need to worry about the text that says we need to change the requirements.txt. All we need are Postgres and foreman v.0.61.

Why Postgres?

Our deployed application at Heroku has a Postgres database. We need to install Postgres just to make sure we have nearly the same environment as they do. After the installation, connect to the Postgres database using PGAdmin III or similar application (just to ensure that the local database server is up).

Why foreman v.061?

It seems like the latest version of foreman has some issues with Windows. I don’t know if there are other working versions, but I tried this one and it worked. From this issue (https://github.com/ddollar/foreman/issues/348), I learned that I need to type:

$ gem uninstall foreman

$ gem install foreman -v 0.61

…and voila. You have just installed foreman v.061.

Well, I think by this time you should have been able to run your app in localhost. BUT, if you access localhost:5000/db, it will tell you that it has missing table/relation or something. This happens because your local Postgres doesn’t have the database that your deployed app in Heroku has. To do this, follow these steps:

Type “SET PGUSER=<your Postgres user>”, then press Enter

Type “SET PGPASSWORD=<your Postgres password>”, then press Enter

That two commands above will give you the credentials to use your Postgres user and password rather than Windows’ User Account.

You might also change 5432 to any port you have chosen during Postgres installation.

Try again “foreman start web -f Procfile.windows” and voila! But, if you access localhost:5000/db it will give you error. To fix this, you must install cURL (http://www.confusedbycode.com/curl/). Then, follow these steps:

Type “heroku pg:backups –app <your app>”

Type “heroku pg:backups public-url”

Copy all those awkward link to notepad. Remove newlines. Add curl in front of id and append ‘> backup.dump’ so it will become [curl “your-awkward-link” > backup.dump]