My favorites | Sign in
Project Home Downloads Wiki Issues Source
Create your first web application
Updated Sep 28, 2010 by


In three short steps you are now going to create a functioning 'Hello World' application. It will be finished in UploadApp.

Create a new project

Use appcfg.rb (appcft.rb.bat on windows) to make an application skeleton. This is where your configuration files will be. When you run appcfg.rb or dev_appserver.rb, always make sure that you are in this directory.

$ appcfg.rb generate_app hello

$ cd hello

And you have finished ... yep that's all you need for now.

Run your app

To run your program, make sure you are still in the "hello" directory and type

hello $ dev_appserver.rb .

Watch as all of the extra files that you need are automatically copied into the right places.

Now have a look at



Your script has been used it two ways.

First, dev_appserver looked for any configuration information that you put into and generated all the xml configuration files. As you didn't put in any configuration information, it just used the defaults.

Second your script is called when a request is sent to your web application. It takes in an argument env, and returns the result 'Hello', tells your browser that it is text/html and that everything worked fine (code 200). Don't worry about the text/html and 200 stuff, the smart Ruby guys have made it even easier (next section).

Have a quick look at what is now in the hello directory to see all the work dev_appserver did for you.

One page to go - now we need to UploadApp!

Comment by, Nov 27, 2009

I needed to 'sudo gem install rack' before "dev_appserver.rb ." would run.

Comment by, Nov 29, 2009

I installed the gems (rack too) but dev_appserver.rb is not in my path. Adding all the bin directories under my gem home does not work either. This is not the first appengine-jruby guide that assumes these are in the path.

What am I missing?

Comment by, Feb 21, 2010

ehh,wheres the dev_appserver file anyway?!...guess I stick to heroku,they seem to put more effort in explanation.

Comment by, Feb 22, 2010

Add /var/lib/gems/1.8/bin to get gem binary commands to work on ubuntu.

Comment by, Aug 14, 2010

[arien@lato hello]$ dev_appserver.rb .

Oops, this does not look like an application directory. You need to create ./app.yaml.

Run 'appcfg.rb generate_app .' to generate a skeleton application.

Comment by turadg, Aug 15, 2010

I got the same error as ed.pratamo but it did work after I ran the suggested command. I'm editing this page to add that step.

Comment by, Sep 1, 2010

I'm getting a warning when running appcfg.rb generate_app: "warning: already initialized constant RUBY_ENGINE"

warning occurs in appengine-tools/gem_bundler.rb:73

Comment by, Sep 1, 2010

OK, finally have the exercise working - I used rubygems1.9.1 instead of 1.8 and it stuffed everything up. I also needed to change the PATH variable to run the appcfg.rb command...

Details are on my blog

Comment by anton.ananich, Nov 7, 2010

Have anyone get this error?

c:\Ruby\Ruby192\bin>appcfg.rb.bat generate_app hello
c:/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/appengine-tools-0.0.16/lib/appengine-tools/gem_bundler.rb:63: warning: already initialized constant RUBY_ENGINE
=> Bundling gems
ERROR:  While executing gem ... (RuntimeError)
    can't add a new key into hash during iteration
Comment by, Nov 14, 2010

I think there are some compatibility problems with Ruby 1.9.2 and 1.9.1. It seems to work fine with 1.8.7. Perhaps the 'InstallEverything' page should be updated until this is fixed.

Comment by, Nov 29, 2010

I need to install gems one by one before I can create application. I posted complete list of installed gems at

Comment by, Mar 12, 2011

@anton.ananich, I've got the same error.

Comment by, Mar 26, 2011

I had to downgrade to rubygems 1.3.7, otherwise, I'd get this error:

$ appcfg.rb generate_app .
=> Bundling gems
ERROR:  While executing gem ... (RuntimeError)
    Unknown command bundle
Comment by, Mar 30, 2011

Confirmed. Ruby 1.8.7 and rubygems 1.3.7 worked. Ruby 1.9 or rubygems 1.6.2 failed.

Comment by, Jun 29, 2011

Every time I try and start the dev app server, I get a segmentation fault.

Jun 29, 2011 11:56:55 AM start
INFO: The server is running at http://localhost:8080/
Segmentation fault

I've downgraded to ruby 1.8.7 and rubygems 1.3.7. Any suggestions?

Comment by, Oct 15, 2011

To downgrade rubygems

gem update --system 1.3.7

Comment by, Oct 15, 2011

lol, for anyone as silly as me,

you don't type "hello $ dev_appserver.rb ."

The program 'hello' can be found in the following package

you type "dev_appserver.rb ."

Comment by, Jun 29, 2012

Getting the following error: $ appcfg.rb generate_app hello => Generating gemfile => Bundling gems ERROR: While executing gem ... (TypeError?)

Source is not a class

Any idea what's going wrong? Not too much out there for this one. Running the following through RVM:

$ ruby -v ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-linux]

$ gem -v 1.3.7

$ gem list


appengine-apis (0.0.24) appengine-rack (0.0.13) appengine-sdk (1.4.3) appengine-tools (0.0.17) bundler (1.1.4) bundler08 (0.8.5) google-appengine (0.0.21) jruby-jars (1.5.6) jruby-rack (1.0.4) rack (1.4.1) rake ( rubygems-bundler (1.0.3) rubygems-update (1.3.7) rubyzip (0.9.9) rvm (

$ dev_appserver.rb hello ~/.rvm/gems/ruby-1.8.7-p358@global/gems/bundler-1.1.4/lib/bundler/dsl.rb:12:in `evaluate': There was an error in your Gemfile, and Bundler cannot continue. (Bundler::GemfileError?)

from ~/.rvm/gems/ruby-1.8.7-p358@global/gems/bundler-1.1.4/lib/bundler/definition.rb:18:in `build' from ~/.rvm/gems/ruby-1.8.7-p358@global/gems/bundler-1.1.4/lib/bundler.rb:135:in `definition' from ~/.rvm/gems/ruby-1.8.7-p358@global/gems/bundler-1.1.4/lib/bundler.rb:123:in `load' from ~/.rvm/gems/ruby-1.8.7-p358@global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:41:in `candidate?' from ~/.rvm/gems/ruby-1.8.7-p358@global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:60:in `setup' from ~/.rvm/gems/ruby-1.8.7-p358@global/gems/rubygems-bundler-1.0.3/lib/rubygems-bundler/noexec.rb:75 from ~/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from ~/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from ~/.rvm/gems/ruby-1.8.7-p358/bin/ruby_noexec_wrapper:9

$ cat hello/Gemfile # Critical default settings: disable_system_gems disable_rubygems bundle_path ".gems/bundler_gems"

# List gems to bundle here: gem 'appengine-rack'

Comment by graeme.lockley, Jul 7, 2012

I am getting the same error as described on Jun 29 and shown below:

$ appcfg.rb generate_app hello => Generating gemfile => Bundling gems ERROR: While executing gem ... (TypeError?)

Source is not a class

My environment is Ubuntu with ruby 1.8.7, gem 1.3.7 and the following gems with associated versions:

appengine-apis (0.0.24) appengine-rack (0.0.13) appengine-sdk (1.4.3) appengine-tools (0.0.17) bundle (0.0.1) bundler (1.1.4) bundler08 (0.8.5) google-appengine (0.0.21) jruby-jars (1.5.6) jruby-rack (1.0.4) rack (1.4.1) rake ( rubygems-bundler (1.0.3) rubygems-update (1.3.7) rubyzip (0.9.9) rvm (

Any help would be great - many thanks

Comment by, Jan 31, 2013

A small typo:

Use appcfg.rb (appcft.rb.bat on windows) to make an application skeleton.

Sign in to add a comment
Powered by Google Project Hosting