Ruby 正在尝试使用Rails 4.0.0设置ROR环境,但Webrick Webserver不会运行UAS

Ruby 正在尝试使用Rails 4.0.0设置ROR环境,但Webrick Webserver不会运行UAS,ruby,ruby-on-rails,mysql,windows-7,Ruby,Ruby On Rails,Mysql,Windows 7,已安装: -Windows 7 64位 -Ruby200-x64 -轨道(4.0.0) -rubygems更新(2.0.3) -mysql2(0.3.11) -mysql-installer-community-5.6.12.1 创建了一个名为simple\u cms的新rails应用程序后,尝试使用命令reails s运行Webrick:(请参阅下面第行的命令) 任何有关配置的帮助都将不胜感激。不知道我哪里出了问题。。。。请帮忙 C:\Users\User\My Documents\sites

已安装: -Windows 7 64位 -Ruby200-x64 -轨道(4.0.0) -rubygems更新(2.0.3) -mysql2(0.3.11) -mysql-installer-community-5.6.12.1

创建了一个名为simple\u cms的新rails应用程序后,尝试使用命令reails s运行Webrick:(请参阅下面第行的命令)

任何有关配置的帮助都将不胜感激。不知道我哪里出了问题。。。。请帮忙

C:\Users\User\My Documents\sites\simple_cms>rails s

Usage:
rails new APP_PATH [options]

Options:
-r, [--ruby=PATH]              # Path to the Ruby binary of your choice
                             # Default: C:/Ruby200-x64/bin/ruby.exe
-m, [--template=TEMPLATE]      # Path to some application template (can be a f
ilesystem path or URL)
  [--skip-gemfile]           # Don't create a Gemfile
-B, [--skip-bundle]            # Don't run bundle install
-G, [--skip-git]               # Skip .gitignore file
  [--skip-keeps]             # Skip source control .keep files
-O, [--skip-active-record]     # Skip Active Record files
-S, [--skip-sprockets]         # Skip Sprockets files
-d, [--database=DATABASE]      # Preconfigure for selected database (options:
mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3
/jdbcpostgresql/jdbc)           # Default: sqlite3

-j, [--javascript=JAVASCRIPT]  # Preconfigure for selected JavaScript library
                             # Default: jquery
-J, [--skip-javascript]        # Skip JavaScript files
  [--dev]                    # Setup the application with Gemfile pointing t
 o your Rails checkout
  [--edge]                   # Setup the application with Gemfile pointing to Rails    repository
-T, [--skip-test-unit]         # Skip Test::Unit files
  [--rc=RC]                  # Path to file containing extra configuration options for rails command
  [--no-rc]                  # Skip loading of extra configuration options f
rom.railsrc文件

运行时选项: -f、 [--force]#覆盖已经存在的文件 -p、 [--假装]#跑步,但不要做任何改变 -q、 [--quiet]#抑制状态输出 -s、 [--skip]#跳过已经存在的文件

Rails选项: -h、 [--help]#显示此帮助消息并退出 -v、 [--version]#显示Rails版本号并退出

说明: “railsnew”命令使用默认值创建一个新的rails应用程序 指定路径处的目录结构和配置

 You can specify extra command-line arguments to be used every time
'rails new' runs in the .railsrc configuration file in your home directory.

Note that the arguments specified in the .railsrc file don't affect the
defaults values shown above in this help message.
例如: rails new~/Code/Ruby/weblog

This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
See the README in the newly created application to get going."



gem list:
C:\Users\User\My Documents\sites\simple\u cms>gem list

*本地宝石*

  • actionmailer(4.0.0)
  • mactionpack(4.0.0)
  • activemodel(4.0.0)
  • activerecord(4.0.0)
  • activerecord-Disprecated_查找程序(1.0.3)
  • activesupport(4.0.0)
  • 阿雷尔(4.0.0)
  • 原子(1.1.10)
  • bigdecimal(1.2.0)
  • 建造商(3.1.4)
  • 捆扎机(1.3.5)
  • 咖啡架(4.0.0)
  • 咖啡脚本(2.2.0)
  • coffee脚本源(1.6.3)
  • erubis(2.7.0)
  • execjs(1.4.0)
  • 徒步旅行(1.2.3)
  • i18n(0.6.4)
  • io控制台(0.4.2)
  • jbuilder(1.4.2)
  • jquery rails(3.0.3、3.0.2)
  • json(1.8.0、1.7.7)
  • 邮件(2.5.4)
  • mime类型(1.23)
  • 小型试验(4.7.5、4.3.2)
  • 多线程json(1.7.7)
  • mysql(2.9.1)
  • mysql2(0.3.11)
  • polyglot(0.3.3)
  • 心理学(2.0.0)
  • 机架(1.5.2)
  • 机架测试(0.6.2)
  • 轨道(4.0.0)
  • 铁路(4.0.0)
  • 耙(10.1.0,0.9.6)
  • rdoc(4.0.0,3.12.2)
  • rubygems更新(2.0.3)
  • sass(3.2.9)
  • sass导轨(4.0.0)
  • sdoc(0.3.20)
  • 链轮(2.10.0)
  • 链轮轨道(2.0.0)
  • 测试单元(2.0.0.0)
  • 雷神(0.18.1)
  • 螺纹安全(0.1.0)
  • 倾斜(1.4.1)
  • 树梢(1.4.14)
  • 涡轮链接(1.2.0)
  • tzinfo(0.3.37)
  • 丑八怪(2.1.1)
Database.yml:

# MySQL.  Versions 4.1 and 5.0 are recommended.
#
# Install the MYSQL driver
#   gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
#   gem 'mysql2'
#
# And be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html

development:
adapter: mysql2
encoding: utf8
database: simple_cms_development
pool: 5
username: root
password: 
host: localhost

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.

test:
adapter: mysql2
encoding: utf8
database: simple_cms_test
pool: 5
username: root
password: 
host: localhost

production:
adapter: mysql2
encoding: utf8
database: simple_cms_production
pool: 5
username: root
password:
host: localhost

如果您只想使用Webrick,最简单的方法是在项目根目录中的config.ru文件上运行Rack,默认情况下Rails在新应用程序中包括:

货架


这将自动启动webrick服务器上的rails应用程序

感谢mil的深入了解。在我的项目目录的根目录中运行rackup启动Webrick服务器,端口9292为localhost querry打开。没问题。是的,在Ruby的世界里,每次你尝试一些新的东西都有点让人困惑,因为Rails之类的东西使用了大量的Ruby助手,比如Rack,它们都是由不同的人开发的。你能做到这一点很好,但在第一次学习Ruby系统时,这会让事情变得更加混乱。不幸的是,运行并没有返回网页。相反,它给了我一个“Gem::Load Error”,它表示:为数据库适配器指定了“mysql2”,但没有加载Gem。将
gem'mysql2'
添加到您的Gemfile中还有其他想法吗?是的,看起来您正在尝试使用MySQL而不是Rails默认的SQLite数据库。因此,由于ruby几乎可以在Gems中完成所有工作,因此您需要安装“mysql2”gem。因此,要做到这一点,请转到rails根目录中的.gemspec文件,并添加以下行:gem.add_dependency“mysql2”,然后运行“bundle”,这应该会拉下您刚才指定为依赖项的新mysql2 gem。另一个很好的见解。我如何知道我的rails根目录在哪里?我试过常规的rails.root,但什么都想不出来。帮助