"Hello World" ruby and python on dreamhost
After having dropped all my plans for a vacation I have nothing better to do so I started with the stupid idea of trying to run different languages on my dreamhost account. Let me start with ruby first.
Open up your favorite editor and copy paste the code below. Save it as testruby.cgi on your server. Change the permissions for that file to chmod 755 testruby.cgi.
If all goes well you should see hello world. I tested it here. Once you've tested it out you know that your account supports ruby.
Now moving on to python. Copy paste the code below to a file testpython.py and change the permissions for that file to chmod 755 testpython.py.
If all goes well you should see hello world. Here is my python hello world script.
This is just one reason why I really like dreamhost. You can tinker with things I even tried to install mono but got bored mid way. There were a little too many steps plus in any case I have a windows hosting for that ;)
Incase you are looking for a web hosting and you are impressed by dreamhost use the promo code VJ97 to save $97 on any of their web hosting plan.
UPDATE: Come to think of it this post sounds like a cheap infomercial, but I really cannot help it.
Open up your favorite editor and copy paste the code below. Save it as testruby.cgi on your server. Change the permissions for that file to chmod 755 testruby.cgi.
#!/usr/bin/env ruby
require "cgi"
cgi = CGI.new("html3")
cgi.out("text/plain"){"Hello World"}
If all goes well you should see hello world. I tested it here. Once you've tested it out you know that your account supports ruby.
Now moving on to python. Copy paste the code below to a file testpython.py and change the permissions for that file to chmod 755 testpython.py.
#!/usr/bin/env python
import cgi
field = cgi.FieldStorage()
print "Content-Type: text/plain\n\n"
print 'Hello, world!\n'
If all goes well you should see hello world. Here is my python hello world script.
This is just one reason why I really like dreamhost. You can tinker with things I even tried to install mono but got bored mid way. There were a little too many steps plus in any case I have a windows hosting for that ;)
Incase you are looking for a web hosting and you are impressed by dreamhost use the promo code VJ97 to save $97 on any of their web hosting plan.
UPDATE: Come to think of it this post sounds like a cheap infomercial, but I really cannot help it.
Comments
for x in field.keys():
print "\t" + x + " : " + field[ x ].value
I know its basic.. but getting started is always the hardest part. :)