node.js - heroku sails 部署上的内部服务器错误

标签 node.js heroku sails.js internal-server-error heroku-postgres

我正在尝试将 sails.js 应用程序部署到 heroku。我已经部署了它,但是每当我打开需要来自数据库的数据的页面时,它都会显示内部服务器错误。我认为这可能是我的数据库连接的问题。我在heroku 上创建了一个postgresql 数据库,并在connections.js 中设置了连接。 Connection.js代码是

module.exports.connections = {
     'mysql-adapter': {
         module: 'sails-mysql',
         url: "postgres://username:pass@ec2-107-22-249-214.compute-1.amazonaws.com:5432/dcebipdspqn7rn",
         port: 5432,
         schema:true
     }
};

我已经在网上搜索了两天并尝试了很多调整,但没有一个对我有用。请告诉我如何解决这个问题。 提前致谢。

更新:

我检查了日志,上面写着

←[33m2015-02-25T14:20:38.793179+00:00 app[web.1]:←[0m  Could not render view "displayroute/viewRoute".  Tried locating view file @ "/app/views/displayroute/view
Route". Layout configured as "layout", so tried using layout @ "/app/views/layout")

但是, View 在本地主机上正确呈现。

最佳答案

您的连接定义看起来完全错误,架构键应该位于模型配置对象中(在 config/models.js 中、在 api/models/YourModelDefinition.js 中或在 sails.config.models 对象中)。

我将引用此处找到的connections.js 中的示例 https://github.com/balderdashy/sails-docs/blob/master/anatomy/myApp/config/connections.js.md

请记住,如果您使用的是 postgres,那么您需要安装适配器

npm install sails-postgresql

关于node.js - heroku sails 部署上的内部服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28713803/

相关文章:

javascript - 在 Mocha 测试中使用 for 循环

javascript - 将多个字符串打洞/组合成一个(可能最短的)字符串,其中包括每个字符串的所有字符

javascript - 解析单个用户输入字符串以获取高级搜索条件

javascript - Heroku 不会加载index.html

javascript - 在 sails.js 中重新排序文件上传的表单参数

node.js - 语法错误: Unexpected Indentifier while compiling ejs problem

ruby - 如何合并 Heroku 上具有相同架构的两个数据库?

python - 在 heroku 上部署时运行一次 python 脚本

javascript - 我可以在 sails.js Assets 目录中轻松运行 vue.js webapp 吗?

sails.js 设置 : How to make a node module available across the sails project (controller/model, 等)?