[英]How to start another rails project along with the current project on Ubuntu 12.04?
I was trying to run another Rails project along with Diaspora . 我试图与Diaspora一起运行另一个Rails项目 。
I used the commands rails server -p 3001
and rails server -p 3002
in the same directory with cd Diaspora
. 我在与cd Diaspora
相同的目录中使用了命令rails server -p 3001
和rails server -p 3002
。
I visited http 127.0.0.1:3001 and in project two http 127.0.0.1:3002. 我访问了http 127.0.0.1:3001,并在项目2中访问了http 127.0.0.1:3002。
But I could open diaspora server only on both the ports. 但是我只能在两个端口上打开diaspora服务器 。
I also tried to create a new project folder (Projects) in the directory Diaspora . 我还尝试在Diaspora目录中创建一个新的项目文件夹(Projects)。
cd Diaspora
cd Projects
rails new project2
I got this output: 我得到以下输出:
Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.
Type 'rails' for help.
How do I solve this problem? 我该如何解决这个问题?
It looks like you started Diaspora two times. 您好像两次启动了Diaspora。
First make sure to you have Diaspora and your other projects alongside each other, not nested. 首先,请确保您具有Diaspora和其他项目彼此并存,而不是嵌套的。
~/Diaspora
~/Projects
Then change into your projects folder, get the latest version of Rails and create a new project: 然后转到您的项目文件夹,获取最新版本的Rails并创建一个新项目:
cd ~/Projects
gem install rails
rails new project2
cd project2
bundle install
There start your other project first: 首先开始其他项目:
cd ~/Projects/project2
bundle exec rails server -p 3002
Now in a second shell start Diaspora: 现在在第二个 shell中启动Diaspora:
cd ~/Diaspora
bundle exec rails server -p 3001
Make sure to use bundle exec
to avoid any version conflicts between the gems Diaspora uses and the gems your new application uses. 确保使用bundle exec
避免Diaspora使用的gem与新应用程序使用的gem之间的任何版本冲突。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.