Can't Start Foreman in Heroku Tutorial Using Python

Can't start foreman in Heroku Tutorial using Python

I had this problem. I fixed it by uninstalling version 0.62 of the foreman gem and installing 0.61.

gem uninstall foreman
gem install foreman -v 0.61

Foreman start fails on Windows following Heroku tutorial

Although this question doesn't seem to be of interest to anyone here (5 views in ~2 hours, 0 answers, 0 comments...), I have found the solution and ready to share it with anyone that will encounter it:

  1. Install the latest ruby from rubyinstaller.org (1.9.3-p194) - Sometimes there is a collision installs of the same version, in my case I've just uninstalled all versions of ruby, but if you already have other application that needs older version then you have to be more careful

  2. Check that your system is default to use this version by invoking ruby -v in command line prompt: and getting ruby 1.9.3p194 (2012-04-20) [i386-mingw32] (you may have to close and re-open cmd, to include the new environment variables)

  3. Still in cmd, invoke:

    gem install foreman
    gem install taps
  4. now go to your Procfile app (e.g. your heroku example app from the tutorial) and execute foreman start, you should see something like this:

    18:23:52 web.1  | started with pid 7212
    18:23:54 web.1 | * Running on http://0.0.0.0:5000/
    18:23:54 web.1 | * Restarting with reloader

Foreman installed by heroku toolbelt on windows can't be found

I had the same problem on Windows7 64-bit, using git's bash. Here's what I did:

  • uninstall the toolbelt, Ruby, and Git using Control Panel's "Program and Features"
  • reinstall the toolbelt to C:\Heroku (see known issue for more info)
  • add C:\Program Files (x86)\git\bin;C:\Heroku\ruby-1.9.2\bin to the system PATH variable: Control Panel, System, Advanced system settings, Environment Variables..., System variables, Variable Path, Edit... (Change ruby-1.9.2 if a future version of the toolbelt includes a newer version of Ruby.)
  • open a git bash window and uninstall foreman version 0.63
    $ gem uninstall foreman
  • then install version 0.61 (see here for more info)
    $ gem install foreman -v 0.61

Now foreman worked for me:

$ foreman start

Heroku Flask - Deploy a 'modular' app from tutorial not working, foreman start works locally

The app.run() was in there twice, which as you noted is what's screwing things up. The app.run() invokes a simply pure-python development server so that you can easily run and/or debug your script.

By invoking it at the module level (right under your import in runserver.py), you were effectively trying to start the development server as the python code was loaded, and then when it went to run it when invoked from the Procfile, the development server was already in flight, having been starting with it's defaults (latest version of Flask is pulling relevant defaults from the SERVER_NAME environment variable). By having it in both places, you were trying to invoke that method twice.

You basically want either the straight up module load (in which case, kill off the code under "if name ...", or you use the code when invoking under main, in which case don't start the service at module load time.



Related Topics



Leave a reply



Submit