ruby-on-rails - HAML 和 ERB 渲染问题

标签 ruby-on-rails apache ubuntu deployment haml

我编写了一个 RoR 应用程序并尝试部署它。

因此,我的 Linode 上出现了以下问题:
浏览器页面仅显示我在 index.html.haml 中编写的代码,而不是预期的页面。
当我尝试改用 index.html 时,我得到了一个有效的渲染页面。
当我尝试使用 index.html.erb 时,它会部分呈现(例如输入,呈现但有很多 erb 代码字符串且没有 css)

同时,我的本地服务器(基于 OS X)运行良好,我将基于 haml 的页面视为正常呈现的 html 页面。 (我快疯了!)

请帮助我了解如何解决该问题。

Ubuntu 12.04、Apache 2.22、ruby 2.0.0、rails 3.2.12、haml 4.0.5、haml-rails 0.4

提前致谢!

UPD
gem 文件

source 'https://rubygems.org'

gem 'rails', '3.2.12'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mysql2'
gem 'devise', '3.0.3'
gem 'debugger'


group :assets do
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
  gem 'therubyracer', :platform => :ruby
end

gem 'less-rails', '~> 2.2.6'
gem 'sass-rails', '~> 3.2.3'
gem 'twitter-bootstrap-rails', '2.2.4'
gem 'friendly_id', '~> 3.2'

gem 'jquery-rails'
gem 'haml', '~> 4.0.0'
gem 'cancan'
gem 'haml-rails'
gem 'rails-i18n', '~> 3.0.0.pre'
gem 'i18n-js'
gem 'obscenity'
gem 'thin'
gem 'will_paginate-bootstrap'
gem 'nifty-generators', :group => :development
gem 'rails_12factor'
gem 'mocha', :group => :test

group :development do
  gem 'sqlite3'
  gem 'capistrano', '2.15.5'
  #gem 'capistrano-rails'
  #gem 'capistrano-bundler'
  #gem 'capistrano-rvm'
  #gem 'rvm1-capistrano3', :require => false
end

gem 'net-ssh', '2.7.0'

gem 'foreman'

Apache 配置
<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin admin@mysite.com
  ServerName  www.mysite.com
  ServerAlias mysite.com
  Options Indexes ExecCGI FollowSymLinks
  PassengerResolveSymlinksInDocumentRoot on
  RailsEnv production
  RailsBaseURI /

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php index.html.erb index.html.haml
  DocumentRoot /home/deploy/public/mysite.com/public/app/views/home

  # Log file locations
  LogLevel warn
  ErrorLog  /home/deploy/public/mysite.com/log/error.log
  CustomLog /home/deploy/public/mysite.com/log/access.log combined
</VirtualHost>

最佳答案

您绝对应该引用一些关于在 Thin + apache 上运行 rails 应用程序的手册;这个应该适合你:

http://www.rackspace.com/knowledge_center/article/ubuntu-apache-rails-and-thin

现在你只是用 apache 提供静态文件。

关于ruby-on-rails - HAML 和 ERB 渲染问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23322849/

相关文章:

ruby-on-rails - Capistrano:无法在任何来源中找到 rake-$WRONG_VERSION

ruby-on-rails - 设计处理重复的登录请求

php - 使用 .htaccess 重定向/投票到/vote.php?vote=1

apache - 如何在 Windows 8 上配置 hadoop 2.3.0?

ubuntu - 如何配置俄语键盘布局(并通过 win+space 切换 US<->RU)?

ubuntu - 如何为 tesseract 创建 .deb 包?

ubuntu - 在启用压缩的情况下发送 Openssl 客户端问候

ruby-on-rails - Mongoid w/Rails,attr_accessible --> "No method found"

ruby-on-rails - Ruby 未定义方法 `[]' 为 nil :NilClass (NoMethodError) error

java - APACHE TOMCAT 服务器未启动