What about dropping the idea of config.ru and just create a dispatch.cgi
like this?

    #!/usr/bin/env ruby
    require 'app'
    Rack::Handler::CGI.run(App)

On Fri, Jul 11, 2008 at 7:33 AM, Eric Mill <[EMAIL PROTECTED]> wrote:

> Some progress: I put most of the code from dispatch.cgi into a
> "config.ru", and dispatch.cgi now uses backticks to literally call
> '/usr/bin/env rackup'.  This works, yet now calls to "/" redirect to
> "/dispatch.cgi/" (this is truly the path in my browser location bar),
> and it messes with my routing.
>
> ====  config.ru  ======
> Dir.chdir '/path/to/app'
> require 'app'
> App::Models::Base.establish_connection :adapter => 'sqlite3',
> :database => 'app.db'
> App.create
> run App
>
> ==== dispatch.cgi  ====
> #!/usr/bin/ruby
> ENV['GEM_PATH'] = '/path/to/gems'
> ENV['GEM_HOME'] = '/path/to/gems'
> puts `/usr/bin/env rackup`
>
>
> And now I am definitely giving up for the night and sleeping.  Any ideas?
>
> Thanks,
> Eric
>
> On Fri, Jul 11, 2008 at 1:06 AM, Eric Mill <[EMAIL PROTECTED]> wrote:
> > Specifically, Dreamhost.  I'm trying to figure out how to get this to
> > work the standard dispatch.cgi or dispatch.fcgi setup.  I've been
> > using the instructions that Magnus sent out when he first announced
> > his plan for Camping 2.0, but they either no longer apply, or I'm an
> > edge case.
> >
> > I've been pushing at it for a while, just to get it working on CGI,
> > and the problem seems to be that dispatch.cgi doesn't end in .ru!
> > Rack tries to "require 'dispatch.cgi'", which is no good.  Here's my
> > dispatch.cgi, with names changed to protect the innocent:
> >
> > ==================
> >
> > #!/usr/bin/env rackup
> >
> > ENV['GEM_PATH'] = '/path/to/local/gems'
> > ENV['GEM_HOME'] = '/path/to/local/gems'
> > ENV['FORCE_ROOT']=1.to_s
> >
> > Dir.chdir '/path/to/app'
> >
> > require 'app'
> > App::Models::Base.establish_connection :adapter => 'sqlite3',
> > :database => 'app.db'
> > App.create
> >
> > run App
> >
> > =============
> >
> > And the error trace, as reported through apache's error logs:
> >
> > /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
> > `gem_original_require': no such file to load -- dispatch.cgi
> > (LoadError)
> >  from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `require'
> >  from /usr/lib/ruby/gems/1.8/gems/rack-0.3.0/bin/rackup:92
> >  from /usr/bin/rackup:19:in `load'
> >  from /usr/bin/rackup:19
> > Premature end of script headers: dispatch.cgi
> >
> > I'm still trying to get my head around the new Rack setup, the problem
> > might be some simple naivete on my part.  Anyone have any ideas how I
> > can push forward?
> >
> > Thanks,
> > Eric
> >
> _______________________________________________
> Camping-list mailing list
> Camping-list@rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
>



-- 
Magnus Holm
_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to