Should I be using Rails or Ruby for this website a

2019-02-17 08:03发布

问题:

I'm very new to web programming (or actually, very old to it, since the last time I messed with the web was HTML 1.1), but now need to deploy a web application quickly. It seems like every time I turn around, there's new acronyms and technologies to learn (JSON, XMLRPC, GWT, Javascript, Rails, etc).

Here's what my app must do:

  1. Given a username and password, authenticate (easy enough, everything does that, apparently).
  2. Allow the user to upload a large glob of data for processing.
  3. Process that data.
  4. Allow the user to download their processed data.

I've already got Java scripts and a database for handling the data. On one machine, I can run a series of command-line programs to process an incoming datablock and put the results back into a mysql database. That is already present and working.

I want to construct a web front-end to this task, using these existing and tested methods. I'm currently leaning to this approach:

  1. Have two machines, a database machine and a web server. That approach allows for later scalability, if necessary, but also requires that I can't assume that the programs that I use to access the data and manipulate it are locally stored.
  2. Use a Ruby DRb application to create a server and a client. The client would pass data to the server which would in turn call these applications.
  3. Use some other Ruby interface to interact with the DRb for the web frontend.

Here's my problem: it looks like most Ruby applications for the web automatically try to build some kind of local database. All the Rails tutorials I've found start with making your own database and interacting with that, which is exactly what I don't want to do.

Is Rails the right technology for me, or using Ruby DRb? Is there some other technology I should be exploring?

If Rails or Ruby is the Right Thing here, what should I be looking at? I already have the Programming Ruby book, and have used that for some of the backend stuff as well as getting basic DRb stuff working.

回答1:

Sounds like Rails might be a bit heavyweight for your situation. Perhaps Sinatra might be a better fit? It's an ultra-lightweight framework: a hello world app might look something like:

require 'sinatra'
get '/' do
  "Hello World!"
end


回答2:

Rails is fine. You can have development and test databases on your local machine and the production database on a remote machine. It doesn't have to be the web server. Get a copy of Agile Web Development with Rails. It'll teach you all you need to know.