Alex Weisberger
2012-Dec-18 20:37 UTC
New to camping-list, and a problem mounting files to a server
Hi to everybody, My name is Alex and I''m new to the Camping mailing list, as well as Camping itself. I have to say, I think this is an awesome project and it is exactly what I''m looking for right now. Something fun to experiment with. Getting a server up and running was very easy, but of course I''ve hit a road block: Any file that I''m referring to in the layout does not mount on the server. For example, I have a very simple app to illustrate this, which has one controller that simply renders a function named pageFunc: def pageFunc img :src => ''labelnegate.jpg'' end labelnegate.jpg is in the same directory as the app, but the image does not show. The terminal that I launched the camping server in shows: 127.0.0.1 - - [18/Dec/2012 16:19:19] "GET /labelnegate.jpg HTTP/1.1" 404 60 0.0146 which is obviously showing a 404 error. Strange indeed. Now I''m not looking for a flat out answer to this problem per se, I''d actually prefer someone to just give me a nudge in the right direction. I''ve been browsing the camping-unabridged.rb source, but I can''t seem to find where or how local files are mounted to the server. Or is that actually Rack''s responsibility? Also, I didn''t include the full source of the app because I don''t know if you guys have code formatting guidelines, so I thought one small function would be acceptable in this case. If you could tell me what (if any) formatting guidelines you have, I will surely respect those in the future. I appreciate any replies. Thanks a lot, -Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20121218/48b280af/attachment-0001.html>
Matma Rex
2012-Dec-18 20:53 UTC
New to camping-list, and a problem mounting files to a server
They aren''t as far as I know. I usually use something like this to mount an entire directory: Camping.goes :App module App use Rack::Static, :urls => [''/static''] end This will make e.g. static/foo.png available at /static/foo.png on your server. -- Matma Rex
Alex Weisberger
2012-Dec-18 21:18 UTC
New to camping-list, and a problem mounting files to a server
That''s perfect! Thanks a lot for the quick reply. It worked for me. -Alex On Tue, Dec 18, 2012 at 3:53 PM, Matma Rex <matma.rex at gmail.com> wrote:> They aren''t as far as I know. I usually use something like this to mount > an entire directory: > > > Camping.goes :App > module App > use Rack::Static, :urls => [''/static''] > end > > This will make e.g. static/foo.png available at /static/foo.png on your > server. > > -- > Matma Rex > ______________________________**_________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/**listinfo/camping-list<http://rubyforge.org/mailman/listinfo/camping-list> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20121218/5a98aedb/attachment.html>