简体   繁体   English

无业游民

[英]Vagrant and RoR

I'm very new with Rails and I've installed Vagrant to run the Rails server. 我对Rails非常陌生,并且已经安装Vagrant来运行Rails服务器。 I've started the server and am able to load localhost:3000, now I don't know where to go. 我已经启动了服务器并能够加载localhost:3000,现在我不知道要去哪里。 The command line is blank and I read that I should type in "script/console", but all I can really do is ctrl-C or -d. 命令行为空,我读到我应该输入“ script / console”,但是我真正能做的就是ctrl-C或-d。

When I tried to run Vagrant in a separate Window with "vagrant up" it says I need to do "Vagrant init" 当我尝试在带有“ vagrant up”的单独窗口中运行Vagrant时,它说我需要执行“ Vagrant init”

Where do I go from here so that I can start going through my tutorials/start developing? 我从哪里去,以便可以开始学习教程/开始开发?

This screencast from RailsCasts should get you started. RailsCasts的截屏视频应该可以帮助您入门。 Some of the suggestions are a bit out-dated but by reading the show notes and comments, you should be able to get up and running. 一些建议有些过时了,但是通过阅读表演说明和注释,您应该可以开始使用。 From there you can modify. 从那里您可以修改。

While getting Rails set up initially with Vagrant will be work, it's an incredibly handy tool to have experience with. 虽然最初可以使用Vagrant设置Rails是可行的,但它是拥有丰富经验的便捷工具。 It becomes even more useful when you incorporate a provisioning tool like Puppet . 当您合并诸如Puppet的置备工具时,它将变得更加有用。

In your terminal if you are running the webrick server via rails server you either need to background it or open a new terminal to get your shell prompt back. 在您的终端中,如果您正在通过rails server运行webrick服务器,则需要使其后台运行或打开新终端以返回Shell提示。 If you ctrl-C out of it you will kill the server. 如果您按ctrl-C退出,则将终止服务器。 Keep in mind, the webrick server should only be used for local development. 请记住,webrick服务器应仅用于本地开发。 It's not a production level web server. 它不是生产级别的Web服务器。 See the Rails Getting Started guide for more details. 有关更多详细信息,请参见《 Rails入门指南》

If you are going to run your rails server in a Vagrant VM, you'll need to configure the port forward in your Vagrantfile so you can access from your host machine. 如果要在Vagrant VM中运行rails服务器,则需要在Vagrantfile中配置端口转发 ,以便可以从主机访问。

config.vm.forward_port 3000, 9080

There error you are seeing would be from you running vagrant up in a directory that doesn't contain a Vagrantfile. 您看到的错误是由于您在不包含Vagrantfile的目录中运行vagrant而导致的。

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

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