Heroku 上的 DataMapper 问题
我正在尝试将一个简单的应用程序部署到 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“公共”不应成为您任何地方路线的一部分。
来自 sintra.rb 介绍文档:
如果您将静态资产放置在其他地方,您也可以自己定义它:
关于最后一行,您是否有根目录的
post
路由?例如:此应用程序是否在本地开发环境中运行?
"public" should not be apart of your routes anywhere.
From the sintra.rb intro documentation:
If you have your static assets placed elsewhere you can define it yourself as well:
Concerning the last line, do you have a
post
route for the root? Something like:Is this application working in a local dev environment?