前提是ruby, rails, bundle等相关已经安装好。或者直接选择的ruby环境的EC2.
取一个git上的例子说明:
取一个git上的例子说明:
1.git clone git://github.com/saasbook/hw2_rottenpotatoes.git 从Git上下载这个git代码。 2. cd hw2_rottenpotatoes 到当前文件目录 3. bundle install --without production 下载一系列的gem包。 --without production
part of the command causes the installer to ignore the PostgreSQL gem for your local installation。(since that gem will cause problems if you're using a development environment without PostgreSQL installed). 4. 你可以去查看下db/seeds.rb
rake db:migrate里面的代码,就是一些电影相关信息。 5. 把所有rottenpotatoes移到本地数据库。 6. rake db:seed to seed your local database with the movies from the seed file. 7. rails server 启动rails server 如果是在本地上跑,或者用VM, 那么只需要打开 localhost:3000/movies 就能看到电影内容了。 问题如果是用的Amazon Web Service, EC2, 还需要在console management的界面左边点 "Security groups", 增加一个"custom TCP" 协议, 端口是3000, source用默认的0.0.0.0/0。 这样就可以开放aws-EC2的3000端口了。 然后用EC2的 public DNS加端口号访问即可。 比如