Heroku 上的 DataMapper 问题

发布于 2024-11-28 01:51:43 字数 1725 浏览 0 评论 0原文

我正在尝试将一个简单的应用程序部署到 Heroku(Sinatra 并使用 DataMapper 进行 ORM),每当我尝试提交表单时,我都会收到这些错误:

2011-08-03T22:52:05+00:00 heroku[router]: GET pure-mist-880.heroku.com/public/css/raffler.css dyno=web.1 queue=0 wait=0ms service=4ms status=404 bytes=18
2011-08-03T22:52:06+00:00 heroku[nginx]: GET /public/css/raffler.css HTTP/1.1 | 12.185.40.153 | 340 | http | 404
2011-08-03T22:52:15+00:00 app[web.1]: DataObjects::SyntaxError - ser=jjimxarsyb&password=2QbwU-iBQ6IckNTQqQ05&host=ec2-107-20-254-131.compute-1.amazonaws.com&port=&path=/jjimxarsyb&query=&fragment=&adapter=postgres:
2011-08-03T22:52:15+00:00 app[web.1]:  /app/.gems/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:114:in `execute_non_

...
2011-08-03T22:52:16+00:00 heroku[nginx]: POST / HTTP/1.1 | 12.185.40.153 | 297 | http | 500

我当前使用的设置行是(取自 Heroku DevCenter) :

DataMapper.setup(:default, ENV['DATABASE_URL'] || 'sqlite3://#{Dir.pwd}/entries.db') 

编辑:

我将 dm-do-adapter 添加到我的 .gems 文件中,解决了该问题。现在,当我提交表单时,浏览器中仍然显示“内部服务器错误”,并且我的日志仅显示:

2011-08-04T01:19:30+00:00 heroku[router]: GET pure-mist-880.heroku.com/ dyno=web.1 queue=0 wait=0ms service=54ms status=200 bytes=919
2011-08-04T01:19:30+00:00 heroku[nginx]: GET / HTTP/1.1 | 71.199.2.204 | 1218 | http | 200
2011-08-04T01:19:31+00:00 heroku[router]: GET pure-mist-880.heroku.com/public/css/raffler.css dyno=web.1 queue=0 wait=0ms service=2ms status=404 bytes=18
2011-08-04T01:19:36+00:00 heroku[router]: POST pure-mist-880.heroku.com/ dyno=web.1 queue=0 wait=0ms service=35ms status=500 bytes=30

我不知道为什么我的 .css 文件没有加载,以及为什么它在我加载时失败提交我的表格。

如果您需要更多代码片段,请告诉我。预先感谢您的任何想法。

I am trying to deploy a simple app to Heroku (Sinatra and using DataMapper for the ORM), and I am getting these errors whenever I try to submit my form:

2011-08-03T22:52:05+00:00 heroku[router]: GET pure-mist-880.heroku.com/public/css/raffler.css dyno=web.1 queue=0 wait=0ms service=4ms status=404 bytes=18
2011-08-03T22:52:06+00:00 heroku[nginx]: GET /public/css/raffler.css HTTP/1.1 | 12.185.40.153 | 340 | http | 404
2011-08-03T22:52:15+00:00 app[web.1]: DataObjects::SyntaxError - ser=jjimxarsyb&password=2QbwU-iBQ6IckNTQqQ05&host=ec2-107-20-254-131.compute-1.amazonaws.com&port=&path=/jjimxarsyb&query=&fragment=&adapter=postgres:
2011-08-03T22:52:15+00:00 app[web.1]:  /app/.gems/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:114:in `execute_non_

...
2011-08-03T22:52:16+00:00 heroku[nginx]: POST / HTTP/1.1 | 12.185.40.153 | 297 | http | 500

The setup line I'm currently using is (taken from the Heroku DevCenter):

DataMapper.setup(:default, ENV['DATABASE_URL'] || 'sqlite3://#{Dir.pwd}/entries.db') 

EDIT:

I added dm-do-adapter to my .gems file and that resolved that issue. Now, when I submit my form, I'm still presented with "Internal Server Error" in the browser, and my logs only show:

2011-08-04T01:19:30+00:00 heroku[router]: GET pure-mist-880.heroku.com/ dyno=web.1 queue=0 wait=0ms service=54ms status=200 bytes=919
2011-08-04T01:19:30+00:00 heroku[nginx]: GET / HTTP/1.1 | 71.199.2.204 | 1218 | http | 200
2011-08-04T01:19:31+00:00 heroku[router]: GET pure-mist-880.heroku.com/public/css/raffler.css dyno=web.1 queue=0 wait=0ms service=2ms status=404 bytes=18
2011-08-04T01:19:36+00:00 heroku[router]: POST pure-mist-880.heroku.com/ dyno=web.1 queue=0 wait=0ms service=35ms status=500 bytes=30

I don't know why my .css file isn't loading, and why it's failing when I submit my form.

If you need more code snippets, let me know. Thank you in advance for any ideas.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

潦草背影 2024-12-05 01:51:43

“公共”不应成为您任何地方路线的一部分。

来自 sintra.rb 介绍文档

请注意,公共目录名称不包含在 URL 中。文件 ./public/css/style.cssexample.com/css/style.css 形式提供。

如果您将静态资产放置在其他地方,您也可以自己定义它:

set :public, File.dirname(__FILE__) + '/static'

关于最后一行,您是否有根目录的 post 路由?例如:

post '/' do
  #form processing using params[:input_name]
end

此应用程序是否在本地开发环境中运行?

"public" should not be apart of your routes anywhere.

From the sintra.rb intro documentation:

Note that the public directory name is not included in the URL. A file ./public/css/style.css is made available as example.com/css/style.css.

If you have your static assets placed elsewhere you can define it yourself as well:

set :public, File.dirname(__FILE__) + '/static'

Concerning the last line, do you have a post route for the root? Something like:

post '/' do
  #form processing using params[:input_name]
end

Is this application working in a local dev environment?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文