简体   繁体   English

带有Github页面的Ruby on Rails

[英]Ruby on Rails with Github Pages

I am attempting to host a project using Github pages. 我正在尝试使用Github页面来托管项目。 As I understand it, Ruby on Rails cannot be run on GH-Pages, with the exception of using Jekyll. 据我了解,除了使用Jekyll之外,Ruby on Rails不能在GH-Pages上运行。 My project is not a blog, and therefor Jekyll seems like overkill. 我的项目不是博客,因此Jekyll似乎有点矫枉过正。 Is there any other way to deploy to GH-Pages? 有没有其他方式部署到GH-Pages? Is there another way to generate a static site from my Ruby on Rails app that would allow for easier deployment? 是否有另一种方法可以从我的Ruby on Rails应用程序生成静态站点,以便更容易部署?

Thanks for any and all input. 感谢任何和所有的输入。

I'm afraid not. 恐怕不是。 Rails is a dynamic system, meaning that the pages are generated from templates combined with data. Rails是一个动态系统,意味着页面是从结合数据的模板生成的。 GH-pages only servers static HTML, so even if you put static content into Rails, you would not be able to run the scripts that serve it. GH页面只服务于静态HTML,因此即使您将静态内容放入Rails,您也无法运行提供它的脚本。

Use Jekyll or Middleman to make a static site. 使用Jekyll或Middleman制作静态网站。 If you really need Rails, use Heroku's free plan . 如果你真的需要Rails,请使用Heroku的免费计划

You could use actionpack-page_caching to generate page-level caches in the public folder of your Rails application, then add those generated pages to your GitHub Pages repository. 您可以使用actionpack-page_caching在Rails应用程序的public文件夹中生成页面级缓存,然后将这些生成的页面添加到您的GitHub Pages存储库中。

However, this entirely defeats the purpose of using something like Rails. 但是,这完全违背了使用像Rails这样的东西的目的。 Why don't you just create static pages directly and upload those to your GitHub Pages repo? 为什么不直接创建静态页面并将其上传到您的GitHub页面回购?

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

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