Re: serving static files
Hi Ben, I apologize for the late reply. For some reason your reply went to the spam folder. Anyway, your solution works perfectly:) Thank you! regards, Seba 2015-03-23 20:15 GMT+01:00 Ben Schumacher : > Sebastian- > > It's hard to guess what the issue with Camping is without a little more > detail. > > You could achieve the same result by having Rack serve the static files, > and skip Camping altogether. Something like this in your config.ru: > > require 'app' > use Rack::Static, :urls => ['/static', ], :root => 'parent-of-static' > run Rack::Adapter::Camping.new(app) > > > Hope this helps, > BEn > > > On 3/23/15 6:40 AM, Sebastjan Hribar wrote: > > Hi, > > I have a problem with serving static files in my app. > I use the code as shown here ( > https://github.com/judofyr/camping/wiki/Serving-Static-Files). > I had to remove the @ sign for FILE to make it work. > > For now I'm only serving one background image: > -- > #index_main { > background-size: cover; > background-image: url("static/slika2.jpg") > } > -- > > When I do this in my windows running from command line the image is > served. > > When I do this in windows server 2008 running as a service, the image is > not shown and if I try accessing it like <>:3301/static/slika2.jpg > I get this error: > > Camping Problem! > /static/slika2.jpg not found > > I'm using config.ru like so: > > $LOAD_PATH << File.expand_path('..') require './<>' > <>.create run <> > > Should I add anything for the static files in config.ru as well? > > I use thin as the server. > > thank you! > regards, > seba > > > ___ > Camping-list mailing > listCamping-list@rubyforge.orghttp://rubyforge.org/mailman/listinfo/camping-list > > > > ___ > Camping-list mailing list > Camping-list@rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: serving static files
Sebastian- It's hard to guess what the issue with Camping is without a little more detail. You could achieve the same result by having Rack serve the static files, and skip Camping altogether. Something like this in your config.ru: require 'app' use Rack::Static, :urls => ['/static', ], :root => 'parent-of-static' run Rack::Adapter::Camping.new(app) Hope this helps, BEn On 3/23/15 6:40 AM, Sebastjan Hribar wrote: Hi, I have a problem with serving static files in my app. I use the code as shown here (https://github.com/judofyr/camping/wiki/Serving-Static-Files). I had to remove the @ sign for FILE to make it work. For now I'm only serving one background image: -- #index_main { background-size: cover; background-image: url("static/slika2.jpg") } -- When I do this in my windows running from command line the image is served. When I do this in windows server 2008 running as a service, the image is not shown and if I try accessing it like <>:3301/static/slika2.jpg I get this error: Camping Problem! /static/slika2.jpg not found I'm using config.ru <http://config.ru> like so: $LOAD_PATH << File.expand_path('..') require './<>' <>.create run <> Should I add anything for the static files in config.ru <http://config.ru> as well? I use thin as the server. thank you! regards, seba ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
serving static files
Hi, I have a problem with serving static files in my app. I use the code as shown here ( https://github.com/judofyr/camping/wiki/Serving-Static-Files). I had to remove the @ sign for FILE to make it work. For now I'm only serving one background image: -- #index_main { background-size: cover; background-image: url("static/slika2.jpg") } -- When I do this in my windows running from command line the image is served. When I do this in windows server 2008 running as a service, the image is not shown and if I try accessing it like <>:3301/static/slika2.jpg I get this error: Camping Problem! /static/slika2.jpg not found I'm using config.ru like so: $LOAD_PATH << File.expand_path('..') require './<>' <>.create run <> Should I add anything for the static files in config.ru as well? I use thin as the server. thank you! regards, seba ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: Serving static files within a single app
Camping.goes :App module App use Rack::Static, :urls => ['/static'] end -- Matma Rex ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Serving static files within a single app
[First of all I am breaking off the topic about serving static files from the "Camping's URL mapping system" thread as it is becoming too hard to follow multiple topics] One solution I have been using for a while is based on the following post (back in 2007): "Serving static files in Camping, with a single route" <http://www.twofishcreative.com/michael/blog/2007/12/12/serving-static-files-in-camping-with-a-single-route>. I do realize that it would be great to have a generic mechanism built-into the framework itself. Maybe a couple configuration options with the basic defaults could include the root of all static content (/public, /files, /static, etc.), and basic file types to be treated as static. I think this feature would be separate from the ability to serve multiple apps (although it might need to factor that in). ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list