简体   繁体   English

在Rails 3中启动rails服务器

[英]Starting a rails server in Rails 3

I have created a new rails project with the command: 我用命令创建了一个新的rails项目:

rails project_name

but now in that project if I run: 但是现在在那个项目中如果我跑:

rails server

I just creates a new project call server, it doesn't start webrick. 我只是创建了一个新的项目调用服务器,它没有启动webrick。

How do I start the server and get rails running? 如何启动服务器并运行rails?

Old versions or rails are bugging you. 旧版本或铁轨正在困扰着你。 Deinstall them using gem uninstall rails . 使用gem uninstall rails卸载它们。 I recommend using RVM with gemsets to create separate environments for each project. 我建议将RVM与gemsets一起使用,为每个项目创建单独的环境。

You're mixing Rails 2 and Rails 3 commands. 你正在混合Rails 2和Rails 3命令。 By the looks of it, you're using Rails 2, which means starting the server would be script/server , not rails server 从它的外观来看,你正在使用Rails 2,这意味着启动服务器将是script/server ,而不是rails server

Step by Step rails server Installation : Step by Step rails服务器安装:

  1. Create Gemset using " rvm create gemset " 使用“rvm create gemset”创建Gemset
  2. rails new 铁路新
  3. goto rails app directory "cd/" 转到rails应用程序目录“cd /”
  4. gem install rails 宝石安装导轨
  5. echo "rvm use " > .rvmrc for example : echo "rvm use 1.9.3-p385@mygemset" > .rvmrc echo“rvm use”> .rvmrc例如:echo“rvm use 1.9.3-p385@mygemset”> .rvmrc
  6. run - "bundle install" 运行 - “捆绑安装”
  7. rails s 导轨

yeah, nothing to do more... :) 是的,没什么可做的...... :)

I had this problem on Ubuntu and found that I had rails 3 installed with gem and rails 2 installed with apt. 我在Ubuntu上遇到这个问题,发现我安装了带有gem的rails 3和使用apt安装的rails 2。 Removing the apt version solved the issue: 删除apt版本解决了这个问题:

sudo apt-get remove rails

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM