我正在尝试用 sinatra 和 mongoid 为自己编写一个小型博客引擎,并尝试使用 sinatra-authentication gem进行登录/退出。
我已经让 sinatra、mongoid 和 haml 都正常工作,但是当我访问任何 sinatra 身份验证页面时,nginx 会抛出一个内部服务器错误。
这是我遇到的错误
Errno::ENOENT - No such file or directory - /opt/nginx/html/raptor.patrickarlt.com/views/layout.haml:
您可以在此处查看我的所有文件,包括我的 nginx 错误日志中的更多文件 https://gist.github.com/854156
获取 '/' 确认 Sinatra 正在工作
得到 '/haml' works 确认 haml 正在工作
get '/private' 重定向到 '/login' 确认 sinatra-authentication 正在工作
得到 '/login' 内部服务器错误
ruby 1.9.2
Nginx 0.8.54
乘客 3.0.2
最佳答案
sinatra-authentication
假定您正在使用布局,除非当前请求是 XMLHttpRequest(参见 the code)。您有两个选择:
- 在
views/layout.haml
中为您的应用程序创建布局,如以下几段所述 http://sinatra-book.gittr.com/#templates 重写 sinatra-authentication 的
use_layout?
方法:module Sinatra module Helpers def use_layout? false end end end
关于ruby - sinatra-authentication gem 不是在寻找正确的 View 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5189561/