Ruby on rails Rails 5和Heroku-Postgres不工作
我一直在遵循我能找到的每一个教程,但似乎仍然无法在Heroku上正确部署我的Rails 5应用程序。我可以让网站启动并运行,但似乎没有数据库连接(我切换到Postgres),所以我无法登录或做任何事情。我也不能访问网站上的一些页面-我没有得到一个错误,只是一个空白页面。任何帮助都会非常好!Ruby on rails Rails 5和Heroku-Postgres不工作,ruby-on-rails,ruby,postgresql,heroku,ruby-on-rails-5,Ruby On Rails,Ruby,Postgresql,Heroku,Ruby On Rails 5,我一直在遵循我能找到的每一个教程,但似乎仍然无法在Heroku上正确部署我的Rails 5应用程序。我可以让网站启动并运行,但似乎没有数据库连接(我切换到Postgres),所以我无法登录或做任何事情。我也不能访问网站上的一些页面-我没有得到一个错误,只是一个空白页面。任何帮助都会非常好! 谢谢!! 代码如下: 博士后问题: 数据库.yml default: &default adapter: postgresql pool: 5 timeout: 5000 host:
谢谢!!
代码如下: 博士后问题: 数据库.yml
default: &default
adapter: postgresql
pool: 5
timeout: 5000
host: ""
development:
adapter: postgresql
encoding: unicode
database: demo_test_development
pool: 5
username: Brandon
password: "password"
timeout: 5000
test:
adapter: postgresql
encoding: unicode
database: demo_test_test
pool: 5
username: Brandon
password: "password"
timeout: 5000
Heroku日志
app[web.1]: I, [2017-03-16T00:08:56.626013 #4] INFO -- : [ce14b2b6-523e-446b-b80e-e6cab9de1234] Completed 500 Internal Server Error in 134ms (ActiveRecord: 30.9ms)
app[web.1]: F, [2017-03-16T00:08:56.627256 #4] FATAL -- : [ce14b2b6-523e-446b-b80e-e6cab9de1234]
app[web.1]: F, [2017-03-16T00:08:56.627343 #4] FATAL -- : [ce14b2b6-523e-446b-b80e-e6cab9de1234] ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "users" does not exist
app[web.1]: LINE 8: WHERE a.attrelid = '"users"'::regclass
app[web.1]: ^
app[web.1]: : SELECT a.attname, format_type(a.atttypid, a.atttypmod),
app[web.1]: pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
app[web.1]: (SELECT c.collname FROM pg_collation c, pg_type t
app[web.1]: WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation),
app[web.1]: col_description(a.attrelid, a.attnum) AS comment
2017-03-16T00:08:56.632358+00:00 heroku[router]: at=info method=POST path="/login_user" yno=web.1 connect=72ms service=243ms status=500 bytes=1669 protocol=https
app[web.1]: FROM pg_attribute a LEFT JOIN pg_attrdef d
app[web.1]: ON a.attrelid = d.adrelid AND a.attnum = d.adnum
app[web.1]: WHERE a.attrelid = '"users"'::regclass
app[web.1]: AND a.attnum > 0 AND NOT a.attisdropped
app[web.1]: ORDER BY a.attnum
app[web.1]: ):
app[web.1]: F, [2017-03-16T00:08:56.627413 #4] FATAL -- : [ce14b2b6-523e-446b-b80e-e6cab9de1234]
app[web.1]: F, [2017-03-16T00:08:56.627489 #4] FATAL -- : [ce14b2b6-523e-446b-b80e-e6cab9de1234] app/models/user.rb:33:in
heroku[router]: at=info method=GET path="/accomodations" host={deleted on purpose} request_id=cb06d7d3-9236-4eb0-b5a7-c05c7db538d8 fwd="73.169.192.70" dyno=web.1 connect=1ms service=22ms status=406 bytes=182 protocol=https
app[web.1]: I, [2017-03-16T00:24:16.409234 #4] INFO -- : [cb06d7d3-9236-4eb0-b5a7-c05c7db538d8] Started GET "/accomodations" for 73.169.192.70 at 2017-03-16 00:24:16 +0000
app[web.1]: I, [2017-03-16T00:24:16.415902 #4] INFO -- : [cb06d7d3-9236-4eb0-b5a7-c05c7db538d8] Processing by HomesController#accomodations as HTML
app[web.1]: I, [2017-03-16T00:24:16.425975 #4] INFO -- : [cb06d7d3-9236-4eb0-b5a7-c05c7db538d8] Completed 406 Not Acceptable in 8ms (ActiveRecord: 0.0ms)
app[web.1]: F, [2017-03-16T00:24:16.427668 #4] FATAL -- : [cb06d7d3-9236-4eb0-b5a7-c05c7db538d8]
2017-03-16T00:24:16.427810+00:00 app[web.1]: F, [2017-03-16T00:24:16.427746 #4] FATAL -- : [cb06d7d3-9236-4eb0-b5a7-c05c7db538d8] ActionController::UnknownFormat (HomesController#accomodations is missing a template for this request format and variant.
app[web.1]:
app[web.1]: request.formats: ["text/html"]
app[web.1]: request.variant: []):
app[web.1]: F, [2017-03-16T00:24:16.427823 #4] FATAL -- : [cb06d7d3-9236-4eb0-b5a7-c05c7db538d8]
app[web.1]: F, [2017-03-16T00:24:16.427921 #4] FATAL -- : [cb06d7d3-9236-4eb0-b5a7-c05c7db538d8] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.2/lib/action_controller/metal/implicit_render.rb:43:in `default_render'
你在Heroku上运行迁移了吗
heroku运行rakedb:migrate
这里的指令:-,对于我使用过的所有rails版本都很好。