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:
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
Check that your system is default to use this version by invoking
ruby -v
in command line prompt: and gettingruby 1.9.3p194 (2012-04-20) [i386-mingw32]
(you may have to close and re-opencmd
, to include the new environment variables)Still in cmd, invoke:
gem install foreman
gem install tapsnow go to your
Procfile
app (e.g. your heroku example app from the tutorial) and executeforeman 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, VariablePath
, Edit... (Changeruby-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
Python Library for Linux Process Management
Clang Error: Unknown Argument: '-Mno-Fused-Madd' (Python Package Installation Failure)
How to Find All the Subclasses of a Class Given Its Name
Why Is Button Parameter "Command" Executed When Declared
Urllib2.Httperror: Http Error 403: Forbidden
How to Switch to New Window in Selenium for Python
Using an Numpy Array as Indices of the 2Nd Dim of Another Array
Correct Way to Try/Except Using Python Requests Module
Docker.Errors.Dockerexception: Error While Fetching Server API Version
How to Generate Dynamic (Parameterized) Unit Tests in Python
How to Subtract a Day from a Date
I Can't Install Pyaudio on Windows? How to Solve "Error: Microsoft Visual C++ 14.0 Is Required."
Convert Pandas Column Containing Nans to Dtype 'Int'
Pip Install MySQL-Python Fails with Environmenterror: MySQL_Config Not Found
How to Preserve Timezone When Parsing Date/Time Strings with Strptime()