2011-09-23 12 views
25

Sto sviluppando l'applicazione nella versione 2.3.2.Come avviare il server dei binari?

Quando digito il comando "rotaie script/server di"

ho ottenuto il seguente output, invece di server di partenza perché?

rails script/server 
Usage: 
    rails new APP_PATH [options] 

Options: 
    -J, [--skip-javascript]  # Skip JavaScript files 
     [--dev]     # Setup the application with Gemfile pointing to your Rails checkout 
     [--edge]     # Setup the application with Gemfile pointing to Rails repository 
    -G, [--skip-git]    # Skip Git ignores and keeps 
    -m, [--template=TEMPLATE]  # Path to an application template (can be a filesystem path or URL) 
    -b, [--builder=BUILDER]  # Path to a application builder (can be a filesystem path or URL) 
     [--old-style-hash]   # Force using old style hash (:foo => 'bar') on Ruby >= 1.9 
     [--skip-gemfile]   # Don't create a Gemfile 
    -d, [--database=DATABASE]  # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc) 
           # Default: sqlite3 
    -O, [--skip-active-record]  # Skip Active Record files 
     [--skip-bundle]   # Don't run bundle install 
    -T, [--skip-test-unit]   # Skip Test::Unit files 
    -S, [--skip-sprockets]   # Skip Sprockets files 
    -r, [--ruby=PATH]    # Path to the Ruby binary of your choice 
           # Default: /home/xichen/.rvm/rubies/ruby-1.8.7-p352/bin/ruby 
    -j, [--javascript=JAVASCRIPT] # Preconfigure for selected JavaScript library 
           # Default: jquery 

Runtime options: 
    -q, [--quiet] # Supress status output 
    -s, [--skip]  # Skip files that already exist 
    -f, [--force] # Overwrite files that already exist 
    -p, [--pretend] # Run but do not make any changes 

Rails options: 
    -h, [--help]  # Show this help message and quit 
    -v, [--version] # Show Rails version number and quit 

Description: 
    The 'rails new' command creates a new Rails application with a default 
    directory structure and configuration at the path you specify. 

Example: 
    rails new ~/Code/Ruby/weblog 

    This generates a skeletal Rails installation in ~/Code/Ruby/weblog. 
    See the README in the newly created application to get going. 

Quando digito linux comando "ls" ho ottenuto le seguenti directory e file che mostra:

app Capfile config criptq db doc features Gemfile Gemfile.lock generate lib log nbproject public Rakefile README script spec test tmp vendor 

mia Gemfile è:

source "http://rubygems.org" 

gem "rails", "2.3.2" 
gem "mysql", "2.8.1" 
gem "fastercsv" 
gem "will_paginate", "2.3.16" 
gem "chronic", "0.6.4" 
gem "whenever", "0.4.1" 
gem "searchlogic", "2.4.28" 

group :development do 
    gem "mongrel", "1.1.5" 
end 

group :test do 
    gem "rspec", "1.3.2" 
    gem "rspec-rails", "1.3.4" 
    gem "factory_girl", "1.3.3" 
end 
+4

Immagino che tu non sia nella cartella della tua app quando scrivi questo – apneadiving

+0

Vuoi dire che dovrei andare alla cartella "app"? Ho provato, ma ho ottenuto lo stesso risultato – Leem

+0

no, alla radice della tua app di rotaie. – apneadiving

risposta

24

In Rails 2.3 applicazione è è solo ./script/server start

+1

" ruby ​​script/server "e" ./script/server start "funzionano entrambi :) – Leem

+0

dovrebbe dire quando inizia: avviare webrick sulla porta 3000 o qualcosa del genere. cambiate aggiungendo -p 8088 o simili –

+1

In Ubuntu/Debian, è solo './script/server'- testato su BeagleBone Black – TekuConcept

22

Per binari 3.2.3 e ultimo versione di rotaie è possibile avviare il server entro:
Prima installazione completa con comando: bundle install o bundle.
Quindi configurare il database su database.yml.
Crea un nuovo database: rake db:create
Quindi avviare il server di rotaie.
rails server o rails s

+0

Questo non funzionerebbe fino a quando non saranno installate tutte le gemme mancanti (linux): 'bundle install' – TekuConcept

6

Per rotaie 2.3.2 è possibile avviare il server da:

ruby script/server 
3

Sulle rotaie 3, il modo più semplice è rails s. Nelle guide 2, è possibile utilizzare ./script/server start.

È anche possibile utilizzare altri server, ad esempio thin o unicorn, che offrono anche maggiori prestazioni.

Uso unicorno, è possibile avviarlo facilmente con unicorn_rails.

BTW, se si utilizza un altro elemento, come un worker (sidekiq, resque, ecc. .

1

Goto directory radice dei tuoi rotaie proiettare

  • In rotaie corsa 2.x> ruby ​​script/server nel caso di rotaie 2.x
  • In rotaie 3.x, l'uso l'uso> rotaie s
5

in rails applicazione 2.3.x è possibile avviare il server dal comando seguente:

ruby script/server

In binari 3.x, è necessario andare per:

rails s

6

Assicurati di essere nella directory giusta quando si avvia il server

siti> yoursite> rotaie s

+0

Tutti i niubbi come me hanno bisogno di questo! Grazie. –

1

Se siete in rails2 versione poi per avviare il server si dispone di fare,

script/server o

./script/server 

Ma se siete in Rails3 o sopra la versione quindi di avviare il server si dispone di fare,

rails server o

rails s 
2

Per le versioni Rails nuovi

Se avete problemi con rails s, a volte il terminale fallisce.

E si dovrebbe cercare di utilizzare:

./bin/rails 

Per accedere comando.

2

Per rotaie 4.1.4 è possibile avviare il server:

$ bin/guide del server

1

in Rails 2.3.x, basta digitare seguente comando per avviare il server rotaie su linux

script/server 

e per ulteriori informazioni leggere il file "README" che è già stato creato nella cartella del progetto rotaie

0

eseguire con nohup per eseguire il processo in background in modo permanente se shell ssh è chiusa/disconnessa

1

Ho anche affrontato lo stesso problema, ma la mia colpa era che stavo correndo "rails s" al di fuori della mia directory dell'applicazione. Dopo aver aperto il cmd, entra nella tua applicazione ed esegui i comandi da loro, ha funzionato per me.

1

Per l'ultima versione di Rails (Rails 5.1.4 rilasciato 7 settembre 2017), è necessario iniziare a guide del server come di seguito:

hello_world_rails_project$ ./bin/rails server 

=> Booting Puma 
=> Rails 5.1.4 application starting in development 
=> Run `rails server -h` for more startup options 
Puma starting in single mode... 
* Version 3.10.0 (ruby 2.4.2-p198), codename: Russell's Teapot 
* Min threads: 5, max threads: 5 
* Environment: development 
* Listening on tcp://0.0.0.0:3000 

Maggiori informazioni aiuto:

hello_world_rails_project$ ./bin/rails --help 

The most common rails commands are: 
generate  Generate new code (short-cut alias: "g") 
console  Start the Rails console (short-cut alias: "c") 
server  Start the Rails server (short-cut alias: "s") 
test   Run tests except system tests (short-cut alias: "t") 
test:system Run system tests 
dbconsole Start a console for the database specified in 
config/database.yml 
      (short-cut alias: "db") 

new   Create a new Rails application. "rails new my_app" creates a 
      new application called MyApp in "./my_app" 
Problemi correlati