Develop a rails program for Heroku on my Mac OS X 10.7.3

Source: Internet
Author: User
Tags heroku logs

Rails 3.1, OS X 10.7.3, and PostgreSQL 9.1.3j

Table of contents
  • 1. PostgreSQL must be used for Databases
  • 2. Install PostgreSQL on OS X 10.7.3
  • 3. Check the installed PostgreSQL
  • 4. PostgreSQL rails project for Databases
  • 5. Deploy web programs to Heroku
1. PostgreSQL must be used for Databases

The official Heroku homepage is opposed to sqlite3 for development and PostgreSQL for production.

2. Install PostgreSQL on OS X 10.7.3

First, check your OS x version. OS X comes with PostgreSQL starting from 10.7.

sw_vers -productVersion

To install the latest version of postgresql, you must delete the old version of the database. For details, refer to this article, which is actually a line of command:

curl http://nextmarvel.net/blog/downloads/fixBrewLionPostgres.sh | sh

It is strongly recommended that you use homebrew to install the database,

brew install postgresql

For installation details, refer to the official PostgreSQL wiki.

3. Check the installed PostgreSQL

Here are some official documents on basic database operations. You can use 'psql-l' to view some existing database lists.

4. PostgreSQL rails project for Databases
rails new myapp --database=postgresql

If you want to switch from a project that has used SQLite to a database, you must change config/database. yml to catch some catch. refer to the discussion on stackoverflow.

Then, 'createdb myapp_development' creates a PostgreSQL database and 'rake DB: migrate' creates a database schema and imports data to a local database. A simple test proves that the database and web programs can work seamlessly.

Do not forget the latest 'git commit 'code.

5. Deploy web programs to Heroku

Please refer to the official Heroku documentation to remind you not to forget to run 'heroku run rake DB: migrate'. Otherwise, the database is empty.

After deployment, run 'heroku open' to access the Web application homepage in a browser.

If a problem occurs when you open the website, you can view the log in 'heroku logs.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.