Search code examples
ruby-on-railsrubyruby-on-rails-3localhostproduction-environment

Issue starting a Ruby on Rails application in production mode on localhost


I am using Ruby on Rails and I am working on localhost with multiple applications.

Since I am using Apache, I tryed to set Virual Hosts like this:

<VirtualHost *:80>
  ServerName <application_name>
  DocumentRoot "/<directory_name>/public"

  #RackEnv development
  RackEnv production

  <Directory "/<directory_name>/public">
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

If I run echo $RAILS_ENV in the Terminal (I use a Mac OS) I get production, but when I try to rake db:create I get

(in /<directory_name>)
<application_name>_test already exists
<application_name>_development already exists

That means I can't create the production database.

So, how to solve that issue? How run my applications in production mode?

Of course, if I go to the browser in order to navigate my application, I get this error:

Mysql2::Error
Unknown database '<application_name>_production'

P.S.: I have Webrick.


Solution

  • RAILS_ENV=production rake db:create