简体   繁体   English

即使正在加载html,也不加载硝态氮(io)上的资产

[英]Assets on nitrous.io are not loading even though html is loading

I am currently developing a website on nitrous and i have some problems. 我目前正在开发有关亚硝酸盐的网站,但遇到一些问题。

my html code loads as a home page but there was no images, there were only images of "file not found" 我的html代码作为主页加载,但是没有图像,只有“找不到文件”的图像

文件未找到

the html was in folder "static_pages", ie. 的HTML是在文件夹“ static_pages”,即。 static_pages/home.html.erb while the images are in the same folder. 图像位于同一文件夹中时,请使用static_pages/home.html.erb ie. 即。 static_pages/images

when i ran rails s and tried to see the web, the images does not load. 当我运行rails并尝试查看网络时,图像不会加载。

Can anyone shed some light on this? 谁能对此有所启发?

If you reference the image by naked filename (in a view), Rails will retrieve them from app/assets/images/ by default. 如果您按裸文件名引用图像(在视图中),则默认情况下,Rails将从app/assets/images/检索它们。 You mentioned this is a static page, so I assume you are referencing the images with a path. 您提到这是一个静态页面,所以我假设您正在使用路径引用图像。 That path would be assumed to be from app/public/ . 该路径将假定来自app/public/

If you create a subdirectory app/public/static_images/ you can reference the images in your static HTML page as static_images/filename . 如果创建子目录app/public/static_images/ ,则可以在静态HTML页面中将图像引用为static_images/filename

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM