Ruby on rail 開發準備

下載安裝Instant Rails ,該軟件包中包含了Ruby,Rails,Apache(HTTP服務器軟件),MySql,而且配置都可自動完成。
完成安裝後就能夠擁有一個完整的Rails開發環境。
下載地址:http://installrails.com/steps/railsinstaller_windowsgit

cd 到相應的項目目錄github

rails new bolg_app 生成骨架結構sql

編輯修改Gemfile文件,調整添加相應的 包windows

bundle update服務器

bundle instalapp

若是bundler提示一個readline有關的錯誤,在Gemfile中加入 gem-rb-readlinepost

加入到git版本控制 編輯 .gitignore文件,忽略不須要版本控制的文件和文件夾命令行

git init版本控制

git add .postgresql

git commit -m "初始化"

在git建立一個倉庫 blogapp

git remote add origin git:github.com/git賬號/blogapp.git

git push -u origin master 推送到github

部署 到 heroku

heroku使用postgresql 因此要把pg加入到生產組,這樣app才能與postgresql通訊

修改Gemfile

group :production do

   gem 'pg'

end

而後執行bundle install --without production 

本地環境就不會安裝生產環境所需的gem了

git commit -a -m "部署到heroku配置Gemfile"

而後註冊一個heroku帳戶

使用heroku toolbelt 安裝所需的軟件

打開命令行

heroku login

輸入賬號,密碼登錄

切換到rail 程序目錄

heroku crate 新建部署應用程序環境

而後 git push heroku master

使用 heroku open 看看能不能顯示一個i額錯誤頁面,顯示了錯誤頁面就對了,由於尚未添加路由,接下來的開發完善就好了。

heroku rename railstutorial--修改你程序的域名

相關文章
相關標籤/搜索