2013-04-08 89 views
0

我從GitHub克隆了一個項目,現在我無法在本地運行它。從使用Heroku的github克隆的rails應用程序訪問問題

我得到這個錯誤在瀏覽器:

Moped::Errors::ConnectionFailure at/
Could not connect to any secondary or primary nodes for replica set <Moped::Cluster nodes=[<Moped::Node resolved_address="127.0.0.1:27017">]> 

,並在終端我得到這個錯誤,當我鍵入任何Heroku的命令:

$ heroku info 
! You do not have access to the app disrupt. 

我是新來的Rails那麼簡單指導/建議會很好。

這就是我mongoid.yml文件

development: 
    # Configure available database sessions. (required) 
    sessions: 
# Defines the default session. (required) 
default: 
    # Defines the name of the default database that Mongoid can connect to. 
    # (required). 
    database: disrupt_development 
    # Provides the hosts the default session can connect to. Must be an array 
    # of host:port pairs. (required) 
    hosts: 
    - localhost:27017 
    options: 
    # Change whether the session persists in safe mode by default. 
    # (default: false) 
    # safe: false 

    # Change the default consistency model to :eventual or :strong. 
    # :eventual will send reads to secondaries, :strong sends everything 
    # to master. (default: :eventual) 
    # consistency: :eventual 

    # How many times Moped should attempt to retry an operation after 
    # failure. (default: 30) 
    # max_retries: 30 

    # The time in seconds that Moped should wait before retrying an 
    # operation on failure. (default: 1) 
    # retry_interval: 1 
    # Configure Mongoid specific options. (optional) 
    options: 
# Configuration for whether or not to allow access to fields that do 
# not have a field definition on the model. (default: true) 
# allow_dynamic_fields: true 

# Enable the identity map, needed for eager loading. (default: false) 
# identity_map_enabled: false 

# Includes the root model name in json serialization. (default: false) 
# include_root_in_json: false 

# Include the _type field in serializaion. (default: false) 
# include_type_for_serialization: false 

# Preload all models in development, needed when models use 
# inheritance. (default: false) 
# preload_models: false 

# Protect id and type from mass assignment. (default: true) 
# protect_sensitive_fields: true 

# Raise an error when performing a #find and the document is not found. 
# (default: true) 
# raise_not_found_error: true 

# Raise an error when defining a scope with the same name as an 
# existing method. (default: false) 
# scope_overwrite_exception: false 

# Skip the database version check, used when connecting to a db without 
# admin access. (default: false) 
# skip_version_check: false 

# User Active Support's time zone in conversions. (default: true) 
# use_activesupport_time_zone: true 

# Ensure all times are UTC in the app side. (default: false) 
# use_utc: false 
test: 
    sessions: 
default: 
    database: disrupt_test 
    hosts: 
    - localhost:27017 
    options: 
    consistency: :strong 
    # In the test environment we lower the retries and retry interval to 
    # low amounts for fast failures. 
    max_retries: 1 
    retry_interval: 0 


production: 
    sessions: 
default: 
    uri: <%= ENV['MONGOHQ_URL'] %> 
+0

你的mongoid.yml是什麼? – lebreeze 2013-04-08 09:17:30

+0

我已將文件內容添加到 – 2013-04-08 10:02:54

回答

0

你是不是爲production環境(或其他)正確設置uri內。

yml文件格式不會知道您的頂級密鑰(它會看到默認值:和生產:作爲單獨的鍵,因爲它們沒有嵌套)之間的區別。

假設你正在使用在Heroku MongoHQ 3.x中,嘗試改變...

production: 
    sessions: 
default: 
    uri: <%= ENV['MONGOHQ_URL'] %> 

...到...

production: 
    sessions: 
    default: 
     uri: <%= ENV['MONGOHQ_URL'] %> 

Heroku MongoHQ docs

應該有更多的信息
+0

以上對不起,這是我的錯誤,文件格式正確,但是當我複製並粘貼時,我沒有正確縮進文本。還有其他建議嗎? – 2013-04-09 12:16:09