This method is not running command in background.
put your test.py under
/app/assets/pythonscripts/test.py
import os, sys
import time
time.sleep(5)
print("python in rails ha ha 5 ")
in show.html.erb
<% cmd = "python3.4 "+ "#{Rails.root}/app/assets/pythonscripts/test.py" %>
<% result = %x[#{cmd} &] %>
<%= result %>
沒有留言:
張貼留言