My question might be rather simple:
Where should I put python script files that I made, to run on a rails on that rails server?
And how do I call the script? (I am looking for what is the path directory)
I have tried to run it on my local machine in which I can store the files anywhere but I really want to follow some type of good convention for doing this on an enterprise server. :/
Right now I have it sitting in the script folder off the root of the arch.
The script prints to the std out since that is what Ruby sees when it runs. So the print out is just going to be stored into a variable and then I will use some functions to figure out the csv string fields and then sorts it into it's corresponding db bins.
But I really am having trouble figuring out where to put the files. There are like no hits on my searches for this specifically. Either it's really easy and I missing something or just no one cares to do this...
Edit: Thanks for the replies but what I said must not have been totally clear so I edit the bullets.
Where do I put the python script (program) ON the rails (folder-wise)? Is there a folder that I should put it that is considered convention. I had it in app/assets/python before and I got error from rails trying to use it as if it was a normal styling file.
If I stored it as: script/python/do-it.py and I wanted to call it what is the path to the location of that file? Is it just as I wrote it or something else because I can't get it to run...
And just to mention.. Using backticks works the best for me I am thinking, I already got that work on local ruby test file, BUT I'm trying to do this on rails with the best conventions that are supposed to be used.... The thing is... I don't know what the conventions are...
So simply this is kinda what I have done (slightly changed for privacy)
<#% result = Array.new %>
<#% Thread.new do %>
<#%= result = `python /home/me/RailsApp/script/py_file.py #{param} &` %>
<#% end %>
<p><#%= puts result %></p>
or is it?
<#% result = Array.new %>
<#% Thread.new do %>
<#%= result = `python script/fixitfelix/py_file.py #{param} &` %>
<#% end %>
<p><#%= puts result %></p>
I'm going to double check to see if I answered my own question.
I had to use a thread thing. The script runs for a bit and it would hang the whole server while it is running.